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 property | Value | Alias | Resolves to |
|---|---|---|---|
--ct-button-background | var(--accent-tint) | {colors.accentTint} | #EAF1FB #182944 |
--ct-button-background-hover | var(--accent-tint-hover) | {colors.accentTintHover} | #D8E4F4 #1F3352 |
--ct-button-background-primary | var(--accent) | {colors.accent} | #0B4EA2 #92B8F5 |
--ct-button-background-primary-hover | var(--accent-hover) | {colors.accentHover} | #0C4691 #A0C1F5 |
--ct-button-color | var(--accent) | {colors.accent} | #0B4EA2 #92B8F5 |
--ct-button-color-disabled | var(--inactive) | {colors.inactive} | #C9CDD6 #465267 |
--ct-button-color-hover | var(--accent-hover) | {colors.accentHover} | #0C4691 #A0C1F5 |
--ct-button-color-primary | var(--accent-ink) | {colors.accentInk} | #FFFFFF #0F141C |
--ct-button-font-size | var(--fs-body) | {type.body} | 16 |
--ct-button-font-size-sm | var(--fs-sub) | {type.sub} | 13 |
--ct-button-font-weight | var(--weight-semibold) | {weight.semibold} | 600 |
--ct-button-frame | var(--shadow-frame) | {shadows.frame} | |
--ct-button-gap | var(--space-8) | {space.s8} | 8 pt |
--ct-button-height-block | var(--size-primary-button) | {size.primaryButton} | 48 pt |
--ct-button-height | var(--size-minimum-tap-target) | {size.minimumTapTarget} | 44 pt |
--ct-button-height-sm | 36px | ||
--ct-button-icon-size | var(--size-inline-glyph) | {size.inlineGlyph} | 18 pt |
--ct-button-padding-x | 18px | ||
--ct-button-padding-x-sm | var(--space-12) | {space.s12} | 12 pt |
--ct-button-radius | var(--r-card) | {radius.card} | 12 pt |
Contract
Contract: components/button.yaml. States are drawn live by transit.js.
Loading the contract…
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
--primarybutton per surface, for its main action. - Use
--plainfor 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;--ghoststill 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 thedisabledattribute, not a class. - Every button keeps a 44 × 44 hit area:
--smand--plain(and the old--ghost) extend theirs with an invisible::before. - Focus shows the Brand focus ring from
:focus-visible.