Skip to content

Signal

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-search

Code

<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 propertyValueAliasResolves to
--ct-nav-rail-backgroundvar(--paper){colors.paper}#FFFFFF #0F141C
--ct-nav-rail-bordervar(--line){colors.line}#DADDE3 #263041
--ct-nav-rail-capsule-backgroundvar(--paper){colors.paper}#FFFFFF #0F141C
--ct-nav-rail-capsule-bordervar(--line){colors.line}#DADDE3 #263041
--ct-nav-rail-capsule-glyph-sizevar(--size-page-picker-glyph){size.pagePickerGlyph}20 pt
--ct-nav-rail-capsule-itemvar(--size-page-picker-item){size.pagePickerItem}50 pt
--ct-nav-rail-capsule-margin-bottomvar(--space-8){space.s8}8 pt
--ct-nav-rail-capsule-margin-xvar(--space-12){space.s12}12 pt
--ct-nav-rail-capsule-paddingvar(--size-page-picker-track-padding){size.pagePickerTrackPadding}4 pt
--ct-nav-rail-capsule-radiusvar(--radius-pill){radius.pill}999 pt
--ct-nav-rail-capsule-shadowvar(--shadow-fab){shadows.floating}
--ct-nav-rail-durationvar(--motion-control-duration){motion.controlDuration}.15 s
--ct-nav-rail-gapvar(--space-4){space.s4}4 pt
--ct-nav-rail-indicator-background-hovervar(--card-hover){colors.cardHover}#E4E6E9 #252B35
--ct-nav-rail-indicator-background-selectedvar(--card){colors.card}#EDEEF1 #1D232D
--ct-nav-rail-indicator-heightvar(--size-nav-rail-indicator-height){size.navRailIndicatorHeight}32 pt
--ct-nav-rail-indicator-radiusvar(--radius-pill){radius.pill}999 pt
--ct-nav-rail-indicator-widthvar(--size-nav-rail-indicator-width){size.navRailIndicatorWidth}56 pt
--ct-nav-rail-item-colorvar(--ink){colors.ink}#101A2E #EEF1F6
--ct-nav-rail-item-color-selectedvar(--accent){colors.accent}#0B4EA2 #92B8F5
--ct-nav-rail-item-font-sizevar(--fs-cap){type.cap}12
--ct-nav-rail-item-font-weightvar(--weight-medium){weight.medium}500
--ct-nav-rail-item-font-weight-selectedvar(--weight-medium){weight.medium}500
--ct-nav-rail-item-gapvar(--space-4){space.s4}4 pt
--ct-nav-rail-item-glyph-sizevar(--size-control-glyph){size.controlGlyph}22 pt
--ct-nav-rail-item-heightvar(--size-nav-rail-item){size.navRailItem}64 pt
--ct-nav-rail-padding-topvar(--space-8){space.s8}8 pt
--ct-nav-rail-widthvar(--size-nav-rail){size.navRail}80 pt

Contract

Contract: components/nav-rail.yaml. States are drawn live by transit.js.

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 has aria-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.