Skip to content

Signal

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).

z 14.2
.ct-map-controls · .ct-map-zoom
.ct-map-controls-area · .ct-map-info · layers menu

Code

<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 &amp; 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 propertyValueAliasResolves to
--ct-map-controls-active-backgroundvar(--accent){colors.accent}#0B4EA2 #92B8F5
--ct-map-controls-active-colorvar(--accent-ink){colors.accentInk}#FFFFFF #0F141C
--ct-map-controls-active-hover-backgroundvar(--accent-hover){colors.accentHover}#0C4691 #A0C1F5
--ct-map-controls-backgroundvar(--paper){colors.paper}#FFFFFF #0F141C
--ct-map-controls-background-opacity82
--ct-map-controls-blur12px
--ct-map-controls-colorvar(--accent){colors.accent}#0B4EA2 #92B8F5
--ct-map-controls-dividervar(--size-map-control-divider){size.mapControlDivider}26 pt
--ct-map-controls-gapvar(--space-map-control-gap){spacing.mapControlGap}12 pt
--ct-map-controls-glyph-sizevar(--size-map-control-glyph){size.mapControlGlyph}20 pt
--ct-map-controls-hover-backgroundvar(--card){colors.card}#EDEEF1 #1D232D
--ct-map-controls-info-glyph-sizevar(--size-map-control-info-glyph){size.mapControlInfoGlyph}18 pt
--ct-map-controls-info-sizevar(--size-map-control-info-circle){size.mapControlInfoCircle}32 pt
--ct-map-controls-pressed-backgroundvar(--card-pressed){colors.cardPressed}#E2E3E7 #2E333D
--ct-map-controls-radiusvar(--radius-pill){radius.pill}999 pt
--ct-map-controls-rulevar(--line){colors.line}#DADDE3 #263041
--ct-map-controls-shadowvar(--shadow-map-control){shadows.mapControl}
--ct-map-controls-sizevar(--size-minimum-tap-target){size.minimumTapTarget}44 pt
--ct-map-controls-zoom-background-opacity86
--ct-map-controls-zoom-colorvar(--ink){colors.ink}#101A2E #EEF1F6
--ct-map-controls-zoom-font-sizevar(--fs-sub){type.sub}13
--ct-map-controls-zoom-font-weightvar(--weight-semibold){weight.semibold}600
--ct-map-controls-zoom-padding-xvar(--space-10){space.s10}10 pt
--ct-map-controls-zoom-padding-yvar(--space-4){space.s4}4 pt
--ct-map-controls-zoom-radiusvar(--radius-pill){radius.pill}999 pt

Contract

Contract: components/map-controls.yaml. States are drawn live by transit.js.

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 shows locate-fill while the map follows the rider and locate once it is moved off.
  • Open the layers menu beside the stack (.ct-menu--leading) with menu.js: Escape and a click outside close it and return focus.
  • Show the zoom level with .ct-map-zoom bottom-right, above the attribution.
  • Draw the map ground with --map-ground, the user location with --location and --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 carries aria-expanded and aria-controls.
  • The zoom label is decorative (pointer-events:none); the map announces zoom changes itself.