Skip to the page
Tactile UI

Kit part · Alerts · Notifications

Banner

A strip the width of the page, above everything, for one announcement: a lamp, one line, an optional key that goes somewhere and a dismiss key. It is a raised plate, not a recess, so it reads as part of the frame and not as a message in the page. It is a labelled region, there on load, and says its thing once. When it goes it closes like a drawer, so the page glides up by its height instead of jumping.

Element
<section class="tui-banner" aria-label="Announcement">
Needs
kit.css + kit.mjs
Covers
Banner · Announcement bar
Rules
banner.rules.md · 6
Finishes
Aluminium · Graphite · Oak · Walnut · Porcelain · Black · Daylight · Night · Paper · Phosphor · E-paper · AMOLED
Volumes
Tactile · Quiet
On this page
  1. Variants
  2. Every state, at once
  3. API
  4. Markup
  5. Accessibility
  6. How it’s built
  7. Rules
  8. Related parts

Seats open in 11 days. Want one email that morning?

Variants

Lode 4.2 is out. Exports now run in the background.

Read the notes
Info · white lamp, with a key

Your plan changed. The new price starts on 1 November.

Done · green lamp

Maintenance tonight from 22:00 to 22:30. Exports will wait.

What this means
Check · amber lamp
Fault · red lamp, role="alert"

Your card expires this month. Update it to keep your plan.

No dismiss key · must stay

Northwind is moving to a new address. From 3 November all post goes to the Harbour Road office, and the Quay Street desk closes.

See the map
A long line wraps, the key drops under it

Lode 4.2 is out.

Notes
Pinned · .tui-banner--sticky

Every state, at once

Both finishes, side by side. Hover, pressed and focus are forced with .is-hover, .is-down and .is-focus; checked and disabled are real.

Aluminium

PartInfoDoneCheckFault
Line

Lode 4.2.

Plan changed.

Planned work.

Slow sign-in.

With a key

Lode 4.2.

Open

Plan changed.

Open

Planned work.

Open

Slow sign-in.

Open
Focus on the cross

Lode 4.2.

Plan changed.

Planned work.

Slow sign-in.

Graphite

PartInfoDoneCheckFault
Line

Lode 4.2.

Plan changed.

Planned work.

Slow sign-in.

With a key

Lode 4.2.

Open

Plan changed.

Open

Planned work.

Open

Slow sign-in.

Open
Focus on the cross

Lode 4.2.

Plan changed.

Planned work.

Slow sign-in.

API

NameKindValuesWhat it does
section.tui-banner[aria-label]elementname itThe strip: a raised plate the width of its container, a labelled region. Name it “Announcement” or what it announces.
.tui-banner__rowelementoneThe row inside, centred, with room each side for the dismiss key. It is the grid row that closes.
.tui-banner__line > .tui-lamp + .tui-banner__textelementthe lamp and the lineThe lamp is hidden from a screen reader and set by data-lamp: white for news, green for done, amber to check, red for a fault. The line is one sentence, the first clause in <b>.
a.tui-banner__linkelementoptional, a flat keyWhere it goes. Say what is there (“Read the notes”), not “Click here”. It drops under the line when the strip is narrow.
.tui-banner__dismiss · data-banner-dismissclass · attributeon a flat icon keyThe cross. Needs aria-label and data-tip. Leave it out for a banner that must stay.
--stickymodifiertui-banner--stickyHolds the strip at the top of the window while the page scrolls under it.
roleattribute"alert" only when urgentA banner is a labelled region and is read as part of the page. Add role="alert" only for a fault that appears while someone works.
dismissBanner(banner)functionneeds kit.mjsLets it go from a script: the row closes, it is hidden, the event fires and focus moves on.
tui-banner-dismisseventbubblesFired on the banner once it is hidden. The page decides whether to remember it.
Enter · Spacekeyon the crossDismisses; focus moves to the next focusable thing after the banner.

Markup

<!-- A labelled region at the very top of the page. The lamp only agrees with the words. -->
<section class="tui-banner" aria-label="Announcement">
  <div class="tui-banner__row">
    <div class="tui-banner__line">
      <span class="tui-lamp" data-lamp="white" data-on aria-hidden="true"></span>
      <p class="tui-banner__text"><b>Lode 4.2 is out.</b> Exports now run in the background.</p>
    </div>
    <a class="tui-key tui-key--flat tui-key--sm tui-banner__link" href="/releases/4-2">Read the notes …→…</a>
    <button class="tui-key tui-key--flat tui-key--icon tui-key--sm tui-banner__dismiss" type="button"
            aria-label="Dismiss announcement" data-tip="Dismiss" data-banner-dismiss>…×…</button>
  </div>
</section>

<!-- Only for something urgent that appears while someone works: add role="alert". -->
import '/kit/kit.mjs';   // wires every [data-banner-dismiss], now and later

document.addEventListener('tui-banner-dismiss', (e) => remember(e.target.id));   // the page decides what to remember
// From a script:
import { dismissBanner } from '/kit/kit.mjs';
dismissBanner(document.querySelector('#release-banner'));

Needs kit.css and kit.mjs. How to install the kit.

Accessibility

  • It is a <section> with an aria-label, so it is a named region a screen reader user can jump to and skip, and it is read in its place in the page. It is not role="alert": a banner that is there when the page loads does not interrupt anyone.
  • The lamp is hidden from a screen reader. The line says what the announcement is, so nothing depends on the lamp’s colour, and the words are in --tui-ink-2 with the first clause in full ink, above 4.5:1 on the plate.
  • The cross is a real button with an aria-label: Tab reaches it after the key, and Enter or Space lets the banner go. After it goes, focus moves to the next focusable thing on the page, never to the top of the document or to nothing.
  • The page does not jump: the row closes with an ease, so what is under it rises smoothly, and if you have scrolled past the banner it goes at once and your place is given back. Under reduced motion it goes at once.
  • On a phone the cross and the key are 44px tall, and the line wraps with the key under it so nothing scrolls sideways. Focus is a 2px ring.

How it’s built

The raised plate the kit gives a panel, with the same bead-blast, cut across the page with square corners and a hairline under it. The row is one grid row of 1fr that eases to 0fr when the banner leaves, so the strip is never given a height of its own, and its contents are hidden as it closes so nothing can be pressed on the way out. The dismiss is about twenty lines in banner.mjs, delegated from the document so banners added later work too, and it borrows the Alert’s way of finding where focus goes next.

Rules

banner.rules.mdIn the brain

One announcement across the top of the page. A lamp agrees with the words, the key goes where the words say, and the dismiss key lets it go without moving anything you are reading.

6 rules in this file, with the foundations they rest on and the anti-patterns that break them. Full rules ship in the brain with the Pass.

Check

Disk 82% full.

Alert

A message let into the surface, with an annunciator: a small lit legend (Note, Done, Check, Fault) beside the words that say what happened.

Preset saved.

Toast

A confirmation after an action: a small plate with a lamp and one factual sentence, read out politely, gone in 3.6 seconds.

Icon key

A key with an icon and no words, square or round: transport, power, the small tools. Its aria-label names it; a tip shows the name.