Components
Page container
A centered content column: page, dashboard and reading widths, with optional page padding.
A centered content column for pages that scroll as a whole (the site intro), a dashboard (--dashboard, stacked with a gap) or a detail column (--reading). --padded adds the page's outer padding when it is not inside a pane.
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
<main class="ct-page ct-page--padded">…</main>
<div class="ct-pane-body"><div class="ct-page ct-page--dashboard">…</div></div>
<div class="ct-pane-body ct-pane-body--detail"><div class="ct-page ct-page--reading">…</div></div>
Responsive behavior
| Viewport | Layout |
|---|---|
| > 760 wide | At most 1040 wide (size.pageWidth), 980 for --dashboard, 600 for --reading. --padded: 40 above, 64 below, the gutter at the sides. |
| ≤ 760 wide | --padded: 24 above, 48 below, 16 at the sides or the side safe area if larger. |
Tokens
From tokens/components.tokens.json. Override one instance by setting the property without the ct- prefix.
| Custom property | Value | Alias | Resolves to |
|---|---|---|---|
--ct-page-gap-dashboard | var(--space-20) | {space.s20} | 20 pt |
--ct-page-padding-bottom-compact | var(--space-page-bottom-compact) | {spacing.pageBottomCompact} | 48 pt |
--ct-page-padding-bottom | var(--space-page-bottom) | {spacing.pageBottom} | 64 pt |
--ct-page-padding-top-compact | var(--space-page-top-compact) | {spacing.pageTopCompact} | 24 pt |
--ct-page-padding-top | var(--space-page-top) | {spacing.pageTop} | 40 pt |
--ct-page-padding-x-compact | var(--space-gutter-compact) | {spacing.gutterCompact} | 16 pt |
--ct-page-padding-x | var(--gutter) | {spacing.gutter} | 20 pt |
--ct-page-width-dashboard | var(--size-dashboard-width) | {size.dashboardWidth} | 980 pt |
--ct-page-width | var(--size-page-width) | {size.pageWidth} | 1040 pt |
--ct-page-width-reading | var(--size-reading-width) | {size.readingWidth} | 600 pt |
Variants
.ct-page is the default column, at most 1040 wide. --dashboard is 980 and stacks its children with a gap; --reading is 600, for text and detail. --padded adds the outer padding to any of them. Nothing else exists.
- A page that scrolls as a whole (the site intro): the default, with
--padded. - Metrics and cards:
--dashboard. - Text or a detail column:
--reading.
<!-- Do -->
<div class="ct-pane-body ct-pane-body--detail"><div class="ct-page ct-page--reading">…</div></div>
<!-- Don't: --padded inside a pane; the pane pads already -->
<div class="ct-pane-body"><div class="ct-page ct-page--padded">…</div></div>
Usage
Do
- Use
--readingfor text and detail so lines stay readable.
Don't
- Don't add
--paddedinside a pane; the pane pads already.
Accessibility
- Put the page in
<main>with one<h1>.
Contract
Contract: components/page.yaml. States are drawn live by transit.js.
Loading the contract…