Components
Map shell
A full-bleed map with side or bottom sheets, a teaser and a tools dock.
A full-bleed map view with its controls, a sheet for the selection (or a teaser when nothing is selected) and an optional tools dock. Wide screens float the sheet at the leading side and the dock beside the controls; compact screens dock them to the bottom, like the iOS core sheet. The map library's own internals and attribution stay the page's.
Live example
The real classes from /site/chitransit.css in frames at phone, tablet and desktop widths, in the docs theme. The contract below shows each width in light and dark.
Code
<section class="ct-view ct-map-shell" aria-label="Map">
<div class="ct-map-canvas" id="map"></div>
<div class="ct-map-controls">…</div>
<div class="ct-map-zoom">z 14</div>
<aside class="ct-map-dock" aria-label="Map tools" hidden>…</aside>
<div class="ct-map-teaser"><b class="ct-map-teaser-title">Map</b><span class="ct-map-teaser-text">Select a station, stop or vehicle.</span></div>
<div class="ct-map-sheet" hidden>
<div class="ct-map-sheet-grabber"></div>
<div class="ct-map-sheet-scroll">…</div>
</div>
</section>
Responsive behavior
| Viewport | Layout |
|---|---|
| > 900 wide | Side sheet and teaser 420 wide (size.sideSheet) at the leading edge; dock 360 wide beside the controls. |
| ≤ 900 wide or ≤ 500 tall | Sheet, teaser and dock are bottom sheets edge to edge; the sheet is at most 72% of the map tall and eases its height; the grabber becomes a 36pt drag handle. |
| ≤ 500 tall and ≥ 600 wide | The sheet stays at the side, at most 48% of the map wide. |
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-shell-background | var(--map-ground) | {colors.mapGround} | #F6F6F3 #141A21 |
--ct-map-shell-controls-top-compact | 28px | ||
--ct-map-shell-dock-background | var(--paper) | {colors.paper} | #FFFFFF #0F141C |
--ct-map-shell-dock-background-opacity | 96 | ||
--ct-map-shell-dock-blur | 10px | ||
--ct-map-shell-dock-border | var(--line) | {colors.line} | #DADDE3 #263041 |
--ct-map-shell-dock-max-height-compact | var(--size-bottom-dock-maximum) | {size.bottomDockMaximum} | 620 pt |
--ct-map-shell-dock-radius | var(--r-modal) | {radius.dialog} | 20 pt |
--ct-map-shell-dock-shadow-compact | var(--shadow-sheet) | {shadows.sheet} | |
--ct-map-shell-dock-shadow | var(--shadow-card) | {shadows.card} | |
--ct-map-shell-dock-width | var(--size-side-dock) | {size.sideDock} | 360 pt |
--ct-map-shell-grabber-color | var(--switch-track) | {colors.switchTrack} | #838995 #6A7488 |
--ct-map-shell-grabber-height | var(--size-grabber-height) | {size.grabberHeight} | 5 pt |
--ct-map-shell-grabber-radius | 3px | ||
--ct-map-shell-grabber-width | var(--size-grabber-width) | {size.grabberWidth} | 40 pt |
--ct-map-shell-grabber-zone-compact | var(--size-minimum-tap-target) | {size.minimumTapTarget} | 44 pt |
--ct-map-shell-grabber-zone | var(--size-sheet-grabber-zone) | {size.sheetGrabberZone} | 28 pt |
--ct-map-shell-inset-compact | var(--space-map-inset-compact) | {spacing.mapInsetCompact} | 12 pt |
--ct-map-shell-inset | var(--space-map-inset) | {spacing.mapInset} | 16 pt |
--ct-map-shell-inset-short | var(--space-8) | {space.s8} | 8 pt |
--ct-map-shell-search-background | var(--paper) | {colors.paper} | #FFFFFF #0F141C |
--ct-map-shell-search-color | var(--muted) | {colors.muted} | #5B6472 #B0BACA |
--ct-map-shell-search-font-size | var(--fs-body) | {type.body} | 16 |
--ct-map-shell-search-gap | var(--space-10) | {space.s10} | 10 pt |
--ct-map-shell-search-glyph-color | var(--ink) | {colors.ink} | #101A2E #EEF1F6 |
--ct-map-shell-search-glyph-size | var(--size-map-control-glyph) | {size.mapControlGlyph} | 20 pt |
--ct-map-shell-search-height | var(--size-map-search-bar) | {size.mapSearchBar} | 48 pt |
--ct-map-shell-search-max-width | var(--size-map-search-bar-maximum-width) | {size.mapSearchBarMaximumWidth} | 400 pt |
--ct-map-shell-search-padding-x | var(--space-16) | {space.s16} | 16 pt |
--ct-map-shell-search-radius | var(--radius-pill) | {radius.pill} | 999 pt |
--ct-map-shell-search-shadow | var(--shadow-fab) | {shadows.floating} | |
--ct-map-shell-sheet-background | var(--paper) | {colors.paper} | #FFFFFF #0F141C |
--ct-map-shell-sheet-max-height | var(--size-bottom-sheet-max-fraction) | {size.bottomSheetMaxFraction} | .72 ratio |
--ct-map-shell-sheet-padding-bottom | var(--space-32) | {space.s32} | 32 pt |
--ct-map-shell-sheet-radius | var(--r-sheet) | {radius.sheet} | 28 pt |
--ct-map-shell-sheet-resize-duration | var(--motion-sheet-resize-duration) | {motion.sheetResizeDuration} | .22 s |
--ct-map-shell-sheet-shadow | var(--shadow-sheet) | {shadows.sheet} | |
--ct-map-shell-sheet-shadow-card | var(--shadow-card) | {shadows.card} | |
--ct-map-shell-sheet-short-fraction | var(--size-side-sheet-short-fraction) | {size.sideSheetShortFraction} | .48 ratio |
--ct-map-shell-sheet-width | var(--size-side-sheet) | {size.sideSheet} | 420 pt |
--ct-map-shell-surface-card-background | var(--card) | {colors.card} | #EDEEF1 #1D232D |
--ct-map-shell-surface-control-background | var(--paper) | {colors.paper} | #FFFFFF #0F141C |
--ct-map-shell-surface-full-detent-opacity | 0 | ||
--ct-map-shell-surface-keyline | var(--line) | {colors.line} | #DADDE3 #263041 |
--ct-map-shell-surface-keyline-width | .5px | ||
--ct-map-shell-surface-tab-bar-background | var(--paper) | {colors.paper} | #FFFFFF #0F141C |
--ct-map-shell-teaser-padding-bottom | var(--space-20) | {space.s20} | 20 pt |
--ct-map-shell-teaser-padding-top | var(--space-8) | {space.s8} | 8 pt |
--ct-map-shell-teaser-text-color | var(--muted) | {colors.muted} | #5B6472 #B0BACA |
--ct-map-shell-teaser-text-gap | var(--space-4) | {space.s4} | 4 pt |
--ct-map-shell-teaser-text-size | var(--fs-sub) | {type.sub} | 13 |
--ct-map-shell-teaser-title-gap | var(--space-14) | {space.s14} | 14 pt |
--ct-map-shell-teaser-title-size | var(--fs-title) | {type.title} | 20 |
--ct-map-shell-teaser-title-weight | var(--weight-bold) | {weight.bold} | 700 |
--ct-map-shell-z-index-controls | var(--z-map-controls) | {zIndex.mapControls} | 500 index |
--ct-map-shell-z-index-dock | var(--z-map-dock) | {zIndex.mapDock} | 700 index |
--ct-map-shell-z-index-sheet | var(--z-map-sheet) | {zIndex.mapSheet} | 600 index |
--ct-map-shell-zoom-bottom-compact | var(--space-16) | {space.s16} | 16 pt |
--ct-map-shell-zoom-bottom | 28px |
Variants
One shell; no variants. Inside .ct-map-shell: .ct-map-canvas, .ct-map-controls, .ct-map-zoom, a .ct-map-sheet or .ct-map-teaser, and an optional .ct-map-dock. The bottom-sheet layout follows the viewport, and sheet.js adds .is-detented and .is-dragging. Surface fills: .ct-map-surface--card, --control and --tab-bar. Nothing else exists.
- Something is selected:
.ct-map-sheet. - Nothing is selected:
.ct-map-teaser. - Tools for the map itself:
.ct-map-dock, beside the controls.
<!-- Do -->
<section class="ct-view ct-map-shell" aria-label="Map">
<div class="ct-map-canvas" id="map"></div>
<div class="ct-map-controls">…</div>
<div class="ct-map-teaser"><b class="ct-map-teaser-title">Map</b><span class="ct-map-teaser-text">Select a station, stop or vehicle.</span></div>
<div class="ct-map-sheet" hidden>…</div>
</section>
<!-- Don't: a hand-made sheet in place of .ct-map-sheet -->
<div class="my-sheet" style="position:absolute;bottom:0">…</div>
Usage
Do
- Drive the bottom sheet with
sheet.js(ChiTransitSheet.attach(sheet, { detents, active, teaser, onClose })): it drags from anywhere on the sheet, throws to the detent the flick projects to, rubber-bands past the top, springs open and closed along the same path, and cross-fades under Reduce Motion. Its grabber is a slider: arrow keys and Home/End move between detents. Closing returns focus to what opened the sheet (returnFocus: falseskips that). - Keep a list route to everything the map shows.
Don't
- Don't restyle the map library's controls or attribution in Signal; theme them in the page.
Accessibility
- Name the sheet by its title; give the drag handle a button alternative inside the sheet.
Contract
Contract: components/map-shell.yaml. States are drawn live by transit.js.
Loading the contract…