Core · Show content
Band
Sets one block of a page on a tint that runs from edge to edge, while its content keeps the column.
Example
A band that tells visitors when registration closes, with its tint running to the edges of the frame.
Registration closes on 30 April
The hall holds 400 people, and the Two days ticket sold out last year.
The tint runs to the edges of this frame; in a page, to the edges of the window. The content keeps the column.
Known issues
The band has three, all from the way it draws the tint.
- A tooltip at its top edge is clipped. The band cuts off whatever sticks out above or below it. A CSS tooltip on a control that is the first thing in a band is cut at 200 percent text and larger. Start the band with its heading, and keep tooltips off the first control. Dropdown menus and other popovers are not clipped.
- Outline and ghost buttons. Their hover colour is the band's own tint, so the hover shows no change. The label and the outline still identify them. Use one primary button, and an outline button for a second way.
- Forced colors. The tint is removed, so the band is its heading, text and buttons between two thin rules in the system text colour.
Code
Copy the markup
<main id="main-content" class="o-container o-stack">
<!-- other sections -->
<section class="o-stack luz-band" aria-labelledby="last-seats-title">
<h2 id="last-seats-title">Registration closes on 30 April</h2>
<p>The hall holds 400 people, and the Two days ticket sold out last year.</p>
<div class="o-actions">
<a class="luz-btn luz-btn--primary" href="/register/">Register now</a>
</div>
</section>
</main>
Variants and options
There are no variants: one class on any block. The layout inside is yours: .o-stack above spaces its children.
| Class | Effect |
|---|---|
.luz-band | The block on a --luz-brand-subtle tint that runs from edge to edge of the page, with 48 px (--luz-space-2xl) above and below its content. The content keeps the page's column |
How it works
CSS from @luz-ds/core. No JavaScript.
- The band stays inside the page's column, so its text keeps the column's start edge. The tint is a
box-shadowthat spreads past the block, cut off above and below byclip-path. A shadow adds no scrollable width;100vwwould, whenever the page has a scrollbar. In an.o-shellthe tint stops at.o-main. - Any block can be a band: a
<section>with its heading, or a plain<div>. - Put it on the page itself, inside the main column. Inside a card or an element with its own background the tint is drawn over that surface, and it runs out of the element when that element is wider than the window.
Without JavaScript
Nothing changes: the band is CSS.
Keyboard and ARIA
The band has no interaction, and adds no role.
- A
<section>named witharia-labelledbybecomes a region landmark; a<div>band is just a block. - The tint carries no meaning, and it is not what groups the band: the section and its heading are. Without the tint (forced colors, print) the grouping stays.
- Controls inside the band keep their own focus ring. The 48 px above and below leaves room for it at 200 percent text and at 320 px wide.
Contrast and focus are in the Design tab.
Design
When to use
Use a band for a call to act near the end of a long page, or for one pause in the middle of it.
When not to use
Do not band every section: when everything stands out, nothing does.
- One band for each screen height at most; two in a row read as a new background, not as a call to act.
- Do not use the tint to say something (a warning, a status): it carries no meaning, and forced colors remove it. Use an alert.
- Do not put a band inside a card or on a
--luz-surfacearea, or around the whole page. In dark mode the primary button falls to 2.7:1 against a tint laid over--luz-surface, under the 3:1 a control's edge needs. - Do not put a
.luz-btn--secondaryon the band: its fill is the tint's own colour, and it reads as plain text.
Do and don't
Writing the content
On a band, the heading says why now, not the action: "Registration closes on 30 April", not "Register".
- Add one sentence of support, one primary button and, if you need a second way, one outline button.
Contrast and focus
The band sets its content on --luz-brand-subtle, laid over the page.
| Part | Colour on background | Light | Dark | High contrast | Needs |
|---|---|---|---|---|---|
Heading and text | --luz-text-primary on --luz-brand-subtle over --luz-surface-page | 14.3:1 | 12.7:1 | 20.1:1 | 4.5:1 |
Secondary text | --luz-text-secondary on --luz-brand-subtle over --luz-surface-page | 5.6:1 | 6.3:1 | 18.5:1 | 4.5:1 |
Link, outline button label and border | --luz-brand-primary on --luz-brand-subtle over --luz-surface-page | 5.1:1 | 6.5:1 | 13.6:1 | 4.5:1 |
Primary button fill | --luz-brand-fill on --luz-brand-subtle over --luz-surface-page | 5.1:1 | 3.0:1 | 13.6:1 | 3:1 |
Primary button label | --luz-text-on-fill on --luz-brand-fill | 6.0:1 | 4.9:1 | 14.1:1 | 4.5:1 |
Focus ring | --luz-focus-ring on --luz-brand-subtle over --luz-surface-page | 5.1:1 | 6.5:1 | 20.1:1 | 3:1 |
Measured from the token values of each mode, rounded down. Needs is the WCAG 2.2 AA minimum: 4.5:1 for text, 3:1 for focus rings and the edges of controls.
- Focus: the band takes none; what is inside keeps its own ring,
--luz-focus-ring, drawn 4 px out. The band's 48 px of padding keeps it inside the tint. - Thin pair: the primary button's fill is 3.0:1 against the tint in dark mode. Its label is 4.9:1 and names the control, so the control is still identified; keep the band on the page, never on a surface.
- Forced colors: the tint is removed and two 1 px
CanvasTextrules mark the band's top and bottom.
Tokens it uses
The 2 tokens that components/band.css reads, by family. Each family links to its page, with the values in every mode. In Figma they are variables with the same names: see Tokens in Figma.
- Spacing and sizing
--luz-space-2xl
Keyboard and ARIA are in the Code tab.