Skip to content

Signal

Components

Button

Text actions. Default is the Brand-tint secondary; --primary fills with Brand; --ghost is a text link; --sm is the compact size.

Live example

Rendered with the real classes from /site/chitransit.css, light (left) and dark (right).

.ct-button
.ct-button--primary
.ct-button--plain
.ct-button--sm
[disabled]

Code

<button class="ct-button">Track</button>
<button class="ct-button ct-button--primary">Save</button>
<button class="ct-button ct-button--plain">Show all</button>
<button class="ct-button ct-button--sm">Export</button>
<button class="ct-button" disabled>Disabled</button>

Tokens

From tokens/components.tokens.json. Override one instance by setting the property without the ct- prefix.

Custom propertyValueAliasResolves to
--ct-button-backgroundvar(--accent-tint){colors.accentTint}#EAF1FB #182944
--ct-button-background-hovervar(--accent-tint-hover){colors.accentTintHover}#D8E4F4 #1F3352
--ct-button-background-primaryvar(--accent){colors.accent}#0B4EA2 #92B8F5
--ct-button-background-primary-hovervar(--accent-hover){colors.accentHover}#0C4691 #A0C1F5
--ct-button-colorvar(--accent){colors.accent}#0B4EA2 #92B8F5
--ct-button-color-disabledvar(--inactive){colors.inactive}#C9CDD6 #465267
--ct-button-color-hovervar(--accent-hover){colors.accentHover}#0C4691 #A0C1F5
--ct-button-color-primaryvar(--accent-ink){colors.accentInk}#FFFFFF #0F141C
--ct-button-font-sizevar(--fs-body){type.body}16
--ct-button-font-size-smvar(--fs-sub){type.sub}13
--ct-button-font-weightvar(--weight-semibold){weight.semibold}600
--ct-button-framevar(--shadow-frame){shadows.frame}
--ct-button-gapvar(--space-8){space.s8}8 pt
--ct-button-height-blockvar(--size-primary-button){size.primaryButton}48 pt
--ct-button-heightvar(--size-minimum-tap-target){size.minimumTapTarget}44 pt
--ct-button-height-sm36px
--ct-button-icon-sizevar(--size-inline-glyph){size.inlineGlyph}18 pt
--ct-button-padding-x18px
--ct-button-padding-x-smvar(--space-12){space.s12}12 pt
--ct-button-radiusvar(--r-card){radius.card}12 pt

Contract

Contract: components/button.yaml. States are drawn live by transit.js.

Variants

.ct-button is the tint button (Brand on Brand tint), the default. Add --primary for the one main action on a surface, or --plain for a low-emphasis text action. Sizes: --sm and --block. Nothing else exists; --ghost is the old name for --plain.

  • One action that completes the task: --primary.
  • A secondary action beside it: the default.
  • A quiet action such as “Show all”: --plain. Inline in running text: a Link button instead.
<!-- Do -->
<button class="ct-button ct-button--primary" type="button">Save</button>
<button class="ct-button" type="button">Cancel</button>
<!-- Don't: no such variant; two primaries -->
<button class="ct-button ct-button--secondary">Cancel</button>

Usage

Do

  • Use one --primary button per surface, for its main action.
  • Use --plain for a standalone low-emphasis action beside other buttons, such as “Show all”. An inline text action in running copy or under content is a Link button. The variants carry the spec and RN names: --tint (the default fill), --primary, --plain; --ghost still works as the old name for --plain.
  • Write the label as a verb: “Save”, “Track”, “Export”.

Don't

  • Don't put two primary buttons side by side.
  • Don't use a button for navigation; use a link.

Accessibility

  • Use a real <button>; disable with the disabled attribute, not a class.
  • Every button keeps a 44 × 44 hit area: --sm and --plain (and the old --ghost) extend theirs with an invisible ::before.
  • Focus shows the Brand focus ring from :focus-visible.