Components
Card
The gray card on white, the layout unit. --empty centers a muted message.
Live example
Rendered with the real classes from /site/chitransit.css, light (left) and dark (right).
Clark/Lake0.2 mi · 4 lines
.ct-cardNo favorites yetStar a stop to keep it here.
.ct-card--emptyCode
<div class="ct-card"><b>Clark/Lake</b><span class="ct-color-muted ct-text-sub">0.2 mi · 4 lines</span></div>
<div class="ct-card ct-card--empty"><b>No favorites yet</b>Star a stop to keep it here.</div>
Tokens
From tokens/components.tokens.json. Override one instance by setting the property without the ct- prefix.
| Custom property | Value | Alias | Resolves to |
|---|---|---|---|
--ct-card-background | var(--card) | {colors.card} | #EDEEF1 #1D232D |
--ct-card-border | var(--line) | {colors.line} | #DADDE3 #263041 |
--ct-card-border-width | 1px | ||
--ct-card-empty-color | var(--muted) | {colors.muted} | #5B6472 #B0BACA |
--ct-card-empty-font-size | var(--fs-sub) | {type.sub} | 13 |
--ct-card-empty-padding-x | var(--space-16) | {space.s16} | 16 pt |
--ct-card-empty-padding-y | var(--space-20) | {space.s20} | 20 pt |
--ct-card-frame | var(--shadow-frame) | {shadows.frame} | |
--ct-card-gap | var(--space-8) | {space.s8} | 8 pt |
--ct-card-padding | var(--space-card-padding) | {spacing.cardPadding} | 14 pt |
--ct-card-radius | var(--r-card) | {radius.card} | 12 pt |
Variants
.ct-card is the default: Card fill, no shadow. --empty centers one muted message; --hairline adds a 1px rule for a card on a card-colored surface. Nothing else exists.
- Content: the default.
- Nothing to show yet:
--empty. - A card on a card-colored surface:
--hairline.
<!-- Do -->
<div class="ct-card ct-card--empty"><b>No favorites yet</b>Star a stop to keep it here.</div>
<!-- Don't: a shadow, or a card inside a card -->
<div class="ct-card" style="box-shadow:0 2px 8px rgb(0 0 0 / .2)">
<div class="ct-card">…</div>
</div>
Usage
Do
- Use gray cards on white as the layout unit.
- Use
--emptyfor an empty state with one muted message.
Don't
- Don't nest cards or add a shadow to a card; sheets and floating controls carry elevation.
Accessibility
- A card is a container, not a control. If the whole card is tappable, make it a link or button with one accessible name.