Components
Map controls (web)
The web map's translucent control stack and zoom label, with the map ground and location colors.
Live example
Rendered with the real classes from /site/chitransit.css, light (left) and dark (right).
.ct-map-controls · .ct-map-zoom.ct-map-controls-area · .ct-map-info · layers menuCode
<div class="sd-map-demo"><div class="ct-map-controls"><button type="button" aria-label="Zoom in">+</button><button type="button" aria-label="Zoom out">−</button><button type="button" aria-label="Show my location"><svg aria-hidden="true"><use href="#i-locate"/></svg></button><button type="button" aria-label="Open map tuner" aria-expanded="false"><svg aria-hidden="true"><use href="#i-tune"/></svg></button></div><span class="ct-map-zoom">z 14.2</span></div>
<div class="sd-map-demo"><div class="ct-map-controls-area"><button class="ct-map-info" type="button" aria-label="Map attribution"><svg aria-hidden="true"><use href="#i-info"/></svg></button><div class="ct-menu ct-menu--leading"><div class="ct-map-controls"><button class="ct-menu-toggle" type="button" aria-label="Map layers" aria-expanded="false" aria-controls="demo-layers"><svg aria-hidden="true"><use href="#i-layers"/></svg></button><button type="button" aria-label="Recenter map"><svg aria-hidden="true"><use href="#i-locate-fill"/></svg></button></div><div class="ct-menu-panel" id="demo-layers" role="menu" aria-label="Map layers"><button class="ct-menu-item" type="button" role="menuitemcheckbox" aria-checked="true"><span class="ct-menu-item-text">Train lines & stations</span><svg class="ct-menu-check" aria-hidden="true"><use href="#i-check"/></svg></button><button class="ct-menu-item" type="button" role="menuitemcheckbox" aria-checked="false"><span class="ct-menu-item-text">Bus stops</span><svg class="ct-menu-check" aria-hidden="true"><use href="#i-check"/></svg></button><button class="ct-menu-item" type="button" role="menuitemcheckbox" aria-checked="true"><span class="ct-menu-item-text">Train vehicles</span><svg class="ct-menu-check" aria-hidden="true"><use href="#i-check"/></svg></button><button class="ct-menu-item ct-menu-item--indent" type="button" role="menuitemcheckbox" aria-checked="true" style="--route:var(--red-line)"><span class="ct-menu-swatch"></span><span class="ct-menu-item-text">Red</span><svg class="ct-menu-check" aria-hidden="true"><use href="#i-check"/></svg></button></div></div></div></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-map-controls-active-background | var(--accent) | {colors.accent} | #0B4EA2 #92B8F5 |
--ct-map-controls-active-color | var(--accent-ink) | {colors.accentInk} | #FFFFFF #0F141C |
--ct-map-controls-active-hover-background | var(--accent-hover) | {colors.accentHover} | #0C4691 #A0C1F5 |
--ct-map-controls-background | var(--paper) | {colors.paper} | #FFFFFF #0F141C |
--ct-map-controls-background-opacity | 82 | ||
--ct-map-controls-blur | 12px | ||
--ct-map-controls-color | var(--accent) | {colors.accent} | #0B4EA2 #92B8F5 |
--ct-map-controls-divider | var(--size-map-control-divider) | {size.mapControlDivider} | 26 pt |
--ct-map-controls-gap | var(--space-map-control-gap) | {spacing.mapControlGap} | 12 pt |
--ct-map-controls-glyph-size | var(--size-map-control-glyph) | {size.mapControlGlyph} | 20 pt |
--ct-map-controls-hover-background | var(--card) | {colors.card} | #EDEEF1 #1D232D |
--ct-map-controls-info-glyph-size | var(--size-map-control-info-glyph) | {size.mapControlInfoGlyph} | 18 pt |
--ct-map-controls-info-size | var(--size-map-control-info-circle) | {size.mapControlInfoCircle} | 32 pt |
--ct-map-controls-pressed-background | var(--card-pressed) | {colors.cardPressed} | #E2E3E7 #2E333D |
--ct-map-controls-radius | var(--radius-pill) | {radius.pill} | 999 pt |
--ct-map-controls-rule | var(--line) | {colors.line} | #DADDE3 #263041 |
--ct-map-controls-shadow | var(--shadow-map-control) | {shadows.mapControl} | |
--ct-map-controls-size | var(--size-minimum-tap-target) | {size.minimumTapTarget} | 44 pt |
--ct-map-controls-zoom-background-opacity | 86 | ||
--ct-map-controls-zoom-color | var(--ink) | {colors.ink} | #101A2E #EEF1F6 |
--ct-map-controls-zoom-font-size | var(--fs-sub) | {type.sub} | 13 |
--ct-map-controls-zoom-font-weight | var(--weight-semibold) | {weight.semibold} | 600 |
--ct-map-controls-zoom-padding-x | var(--space-10) | {space.s10} | 10 pt |
--ct-map-controls-zoom-padding-y | var(--space-4) | {space.s4} | 4 pt |
--ct-map-controls-zoom-radius | var(--radius-pill) | {radius.pill} | 999 pt |
Contract
Contract: components/map-controls.yaml. States are drawn live by transit.js.
Loading the contract…
Variants
One stack; no variants. .ct-map-controls holds the glyph buttons; .ct-map-zoom, .ct-map-info, .ct-map-controls-area and the layers menu (.ct-menu.ct-menu--leading) go with it. Recenter shows locate-fill while the map follows the rider and locate once it is moved off. Reduce Transparency and Increase Contrast make the glass solid on their own. Nothing else exists.
<!-- Do -->
<div class="ct-map-controls-area">
<button class="ct-map-info" type="button" aria-label="Map attribution"><svg aria-hidden="true"><use href="#i-info"/></svg></button>
<div class="ct-menu ct-menu--leading">
<div class="ct-map-controls">
<button class="ct-menu-toggle" type="button" aria-label="Map layers" aria-expanded="false" aria-controls="layers"><svg aria-hidden="true"><use href="#i-layers"/></svg></button>
<button type="button" aria-label="Recenter map"><svg aria-hidden="true"><use href="#i-locate-fill"/></svg></button>
</div>
<div class="ct-menu-panel" id="layers" role="menu" aria-label="Map layers">…</div>
</div>
</div>
<!-- Don't: your own glass, or a button with no name -->
<div class="ct-map-controls" style="background:rgb(255 255 255 / .6);backdrop-filter:blur(12px)">
<button type="button"><svg><use href="#i-locate"/></svg></button>
</div>
Usage
Do
- In the app, put the layers button over Recenter in one stack, bottom-trailing just above the sheet, with the ⓘ circle beside it (
.ct-map-controls-area). Recenter showslocate-fillwhile the map follows the rider andlocateonce it is moved off. - Open the layers menu beside the stack (
.ct-menu--leading) withmenu.js: Escape and a click outside close it and return focus. - Show the zoom level with
.ct-map-zoombottom-right, above the attribution. - Draw the map ground with
--map-ground, the user location with--locationand--location-halo.
Don't
- Don't put more than three buttons in a stack.
- Don't draw your own glass; iOS uses native glass buttons and the system menu with the same order and glyphs.
Accessibility
- Each button has an
aria-label; a button that opens a panel carriesaria-expandedandaria-controls. - The zoom label is decorative (
pointer-events:none); the map announces zoom changes itself.