StartFoundationsComponentsContent

Banner

A banner is a full-width strip at the top of the app for a message about the whole app or account. You put any content inside it.

Stable Figma
OverviewUsageAPIAccessibility
Your Team trial ends in 3 days. Upgrade
<tk-banner tone="warning" label="Trial ending">
  Your Team trial ends in 3 days.
  <tk-button slot="actions" size="small">Upgrade</tk-button>
</tk-banner>

Anatomy

Part What it is
tk-banner the element; spans the full width
banner part the strip: background and bottom border
content part the centered row inside, up to --tk-banner-max-width wide
icon slot and part the leading intent icon; decorative
default slot (body part) your content: text, a link, a countdown, a small form
actions slot and part optional actions at the end of the row
dismiss button the ✕, only with dismissible

Variants

We've refreshed the dashboard. A new version is available. You're back online. Maintenance tonight at 22:00 UTC. Your payment failed. Update your card.
<tk-banner label="Announcement">We've refreshed the dashboard.</tk-banner>
<tk-banner tone="info" label="New version">A new version is available.</tk-banner>
<tk-banner tone="success" label="Connection">You're back online.</tk-banner>
<tk-banner tone="warning" label="Maintenance">Maintenance tonight at 22:00 UTC.</tk-banner>
<tk-banner tone="error" label="Billing">Your payment failed. Update your card.</tk-banner>
  • neutral (default): a plain announcement.
  • info: a notice or advice.
  • success: good news about the whole app.
  • warning: a caution, such as maintenance or a trial ending.
  • error: a problem to fix, such as billing or being offline.

Each tone has its own icon shape, a triangle for warning and circles for the rest. Say the intent in the text too; color alone doesn't tell everyone.

Treatment

treatment="loud" makes an inverse strip: dark in the light theme, light in the dark theme. It ignores the tone's color, but the tone still picks the icon.

We use cookies to improve your experience. Privacy policy
<tk-banner treatment="loud" label="Cookie notice">
  We use cookies to improve your experience.
  <tk-link slot="actions" href="/privacy" color="inverse">Privacy policy</tk-link>
</tk-banner>

Use subtle (default) for everyday banners and loud for a message that must stand out. There is no solid red or amber strip.

Placement

  • static (default): the banner sits in the page flow and pushes the content down.
  • sticky: the banner stays at the top while the page scrolls and keeps its space.

The strip spans the full width. Its content row is centered and caps at 1200px; set --tk-banner-max-width to your page column so the text lines up with the page below.

Put the banner early in the DOM, so keyboard and screen reader users meet it first, as they see it. To pin a banner over the content, reserve the space for it in your page layout.

Actions

Version 3.2 is ready. What's new Reload
<tk-banner tone="info" label="New version">
  Version 3.2 is ready.
  <tk-link slot="actions" href="/changelog" treatment="quiet">What's new</tk-link>
  <tk-button slot="actions" size="small">Reload</tk-button>
</tk-banner>
  • Put a quiet tk-link or a secondary or ghost tk-button in slot="actions".
  • Use at most one main and one secondary action. If you need more, use a dialog or a page.
  • On a loud strip, use tk-link color="inverse". Buttons have no inverse style and may lack contrast there.

Dismiss

You're back online.
<tk-banner tone="success" label="Connection" dismissible>You're back online.</tk-banner>

dismissible adds a ✕ named by dismiss-label. Clicking it fires a cancelable tk-dismiss event, and the banner hides itself unless you call preventDefault().

banner.addEventListener('tk-dismiss', (event) => {
  event.preventDefault();
  saveDismissed('maintenance');
  banner.remove();
});
  • Don't make a banner dismissible if the user must act on it, such as a blocked account.
  • If the banner had focus, move focus somewhere sensible after it closes.