Components
Section header
A section title with trailing meta. Web: .ct-section-header; React Native: SectionHeader.
A section title with optional trailing meta on its baseline. It starts each group in a list, a sheet or a page. iOS: SignalSectionHeader in the Signal package.
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
<div class="ct-section-header">
<h2>Arrivals</h2>
<span class="ct-section-header-meta">Updated now</span>
</div>
Responsive behavior
| Viewport | Layout |
|---|---|
| Every width | The same: spacing.sectionGap (24) above, 6 below; 4 above when it opens its container. |
React Native
Use the shared component from @chitransit/signal/rn. API and live gallery.
Tokens
From tokens/components.tokens.json. Override one instance by setting the property without the ct- prefix.
| Custom property | Value | Alias | Resolves to |
|---|---|---|---|
--ct-section-header-gap | var(--space-8) | {space.s8} | 8 pt |
--ct-section-header-margin-bottom | var(--space-6) | {space.s6} | 6 pt |
--ct-section-header-margin-top | var(--space-section-gap) | {spacing.sectionGap} | 24 pt |
--ct-section-header-margin-top-first | var(--space-4) | {space.s4} | 4 pt |
--ct-section-header-meta-color | var(--muted) | {colors.muted} | #5B6472 #B0BACA |
--ct-section-header-meta-font-size | var(--fs-sub) | {type.sub} | 13 |
--ct-section-header-title-color | var(--ink) | {colors.ink} | #101A2E #EEF1F6 |
--ct-section-header-title-font-size | var(--fs-title) | {type.title} | 20 |
--ct-section-header-title-font-weight | var(--weight-bold) | {weight.bold} | 700 |
Variants
One form; no variants. .ct-section-header holds an <h2> (or .ct-section-header-title) and an optional .ct-section-header-meta; the first one in a container sits closer to the top. Nothing else exists.
<!-- Do -->
<div class="ct-section-header">
<h2>Arrivals</h2>
<span class="ct-section-header-meta">Updated now</span>
</div>
<!-- Don't: a control in the meta -->
<div class="ct-section-header">
<h2>Arrivals</h2>
<button class="ct-section-header-meta" type="button">Refresh</button>
</div>
Usage
Do
- Use the heading level that fits the outline; the look stays the same.
Don't
- Don't put controls in the meta; it is text.
Accessibility
- The title is a real heading; the meta reads after it.
Contract
Contract: components/section-header.yaml. States are drawn live by transit.js.
Loading the contract…