Components
Navigation rail
The app's pages: a full-height rail of glyph-over-label buttons from the medium breakpoint up, the page capsule on phones, and the floating map search bar.
Live example
Rendered with the real classes from /site/chitransit.css, light (left) and dark (right).
.ct-nav-rail.ct-nav-rail--capsule.ct-map-searchCode
<nav class="ct-nav-rail" aria-label="App views (demo)" style="height:auto;padding-bottom:var(--space-8)"><button class="ct-nav-rail-item" type="button" aria-current="page"><span class="ct-nav-rail-indicator"><svg aria-hidden="true"><use href="#i-nearby"/></svg></span><span>Nearby</span></button><button class="ct-nav-rail-item" type="button"><span class="ct-nav-rail-indicator"><svg aria-hidden="true"><use href="#i-star-fill"/></svg></span><span>Favorites</span></button><button class="ct-nav-rail-item" type="button"><span class="ct-nav-rail-indicator"><svg aria-hidden="true"><use href="#i-tune"/></svg></span><span>Settings</span></button><button class="ct-nav-rail-item" type="button"><span class="ct-nav-rail-indicator"><svg aria-hidden="true"><use href="#i-search"/></svg></span><span>Search</span></button></nav>
<nav class="ct-nav-rail ct-nav-rail--capsule" aria-label="App views on a phone (demo)" style="flex:1;max-width:calc(var(--size-pane-narrow) * 1.15)"><button class="ct-nav-rail-item" type="button"><span class="ct-nav-rail-indicator"><svg aria-hidden="true"><use href="#i-nearby"/></svg></span><span>Nearby</span></button><button class="ct-nav-rail-item" type="button" aria-current="page"><span class="ct-nav-rail-indicator"><svg aria-hidden="true"><use href="#i-star-fill"/></svg></span><span>Favorites</span></button><button class="ct-nav-rail-item" type="button"><span class="ct-nav-rail-indicator"><svg aria-hidden="true"><use href="#i-tune"/></svg></span><span>Settings</span></button><button class="ct-nav-rail-item" type="button"><span class="ct-nav-rail-indicator"><svg aria-hidden="true"><use href="#i-search"/></svg></span><span>Search</span></button></nav>
<div role="search"><button class="ct-map-search" type="button" aria-label="Search lines, routes, stations and stops"><svg aria-hidden="true"><use href="#i-search"/></svg><span>Lines, routes, stations and stops</span></button></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-nav-rail-background | var(--paper) | {colors.paper} | #FFFFFF #0F141C |
--ct-nav-rail-border | var(--line) | {colors.line} | #DADDE3 #263041 |
--ct-nav-rail-capsule-background | var(--paper) | {colors.paper} | #FFFFFF #0F141C |
--ct-nav-rail-capsule-border | var(--line) | {colors.line} | #DADDE3 #263041 |
--ct-nav-rail-capsule-glyph-size | var(--size-page-picker-glyph) | {size.pagePickerGlyph} | 20 pt |
--ct-nav-rail-capsule-item | var(--size-page-picker-item) | {size.pagePickerItem} | 50 pt |
--ct-nav-rail-capsule-margin-bottom | var(--space-8) | {space.s8} | 8 pt |
--ct-nav-rail-capsule-margin-x | var(--space-12) | {space.s12} | 12 pt |
--ct-nav-rail-capsule-padding | var(--size-page-picker-track-padding) | {size.pagePickerTrackPadding} | 4 pt |
--ct-nav-rail-capsule-radius | var(--radius-pill) | {radius.pill} | 999 pt |
--ct-nav-rail-capsule-shadow | var(--shadow-fab) | {shadows.floating} | |
--ct-nav-rail-duration | var(--motion-control-duration) | {motion.controlDuration} | .15 s |
--ct-nav-rail-gap | var(--space-4) | {space.s4} | 4 pt |
--ct-nav-rail-indicator-background-hover | var(--card-hover) | {colors.cardHover} | #E4E6E9 #252B35 |
--ct-nav-rail-indicator-background-selected | var(--card) | {colors.card} | #EDEEF1 #1D232D |
--ct-nav-rail-indicator-height | var(--size-nav-rail-indicator-height) | {size.navRailIndicatorHeight} | 32 pt |
--ct-nav-rail-indicator-radius | var(--radius-pill) | {radius.pill} | 999 pt |
--ct-nav-rail-indicator-width | var(--size-nav-rail-indicator-width) | {size.navRailIndicatorWidth} | 56 pt |
--ct-nav-rail-item-color | var(--ink) | {colors.ink} | #101A2E #EEF1F6 |
--ct-nav-rail-item-color-selected | var(--accent) | {colors.accent} | #0B4EA2 #92B8F5 |
--ct-nav-rail-item-font-size | var(--fs-cap) | {type.cap} | 12 |
--ct-nav-rail-item-font-weight | var(--weight-medium) | {weight.medium} | 500 |
--ct-nav-rail-item-font-weight-selected | var(--weight-medium) | {weight.medium} | 500 |
--ct-nav-rail-item-gap | var(--space-4) | {space.s4} | 4 pt |
--ct-nav-rail-item-glyph-size | var(--size-control-glyph) | {size.controlGlyph} | 22 pt |
--ct-nav-rail-item-height | var(--size-nav-rail-item) | {size.navRailItem} | 64 pt |
--ct-nav-rail-padding-top | var(--space-8) | {space.s8} | 8 pt |
--ct-nav-rail-width | var(--size-nav-rail) | {size.navRail} | 80 pt |
Contract
Contract: components/nav-rail.yaml. States are drawn live by transit.js.
Loading the contract…
Variants
.ct-nav-rail, the default, runs the full height at the leading edge wider than 760; --capsule is the phone's floating pill at the bottom of the sheet. The current page carries aria-current="page". Nothing else exists.
<!-- Do -->
<nav class="ct-nav-rail ct-nav-rail--capsule" aria-label="App views">
<button class="ct-nav-rail-item" type="button" aria-current="page"><span class="ct-nav-rail-indicator"><svg aria-hidden="true"><use href="#i-nearby"/></svg></span><span>Nearby</span></button>
…
</nav>
<!-- Don't: tab roles, or a Map item -->
<nav class="ct-nav-rail" role="tablist" aria-label="App views">
<button class="ct-nav-rail-item" role="tab" aria-selected="true">Map</button>
</nav>
Usage
Do
- Use the rail wider than the medium breakpoint (760), with the page in a flush 420 panel beside it and the map search floating over the map.
- Use the capsule at phone width, at the bottom of the sheet.
- Keep the order Nearby, Favorites, Settings, Search everywhere.
Don't
- Don't use tablist and tab roles; these are page buttons with aria-current.
- Don't add a Map item: the map is always behind the sheet or panel.
- Don't hover with Line; it reads as selected.
Accessibility
- Wrap the items in
<nav aria-label="App views">; the current one hasaria-current="page". - The glyphs are hidden; each button is named by its label.
- The rail item draws the focus ring around its indicator, matching its pill.