StartFoundationsComponentsContent

Section message

A section message tells the user something about one part of the page. It sits in the content and stays until it's resolved or dismissed.

Stable Figma
OverviewUsageAPIAccessibility
Heads up Two-factor authentication will be required for all admins next month.
<tk-section-message>
  <span slot="title">Heads up</span>
  Two-factor authentication will be required for all admins next month.
</tk-section-message>

Anatomy

Part What it is
tk-section-message the element; a tinted block with rounded corners (message part)
icon slot and part the leading intent icon; decorative
title slot and part an optional title; a heading or a <span>
default slot (body part) the message: one or two short sentences, required
actions slot and part optional actions under the message
dismiss button the ✕, only with dismissible

Variants

New members get access in about an hour. Drafts are saved for 30 days. Your calendar is connected. Vacation mode is on. You won't get alerts. We couldn't save your changes. Try again.
<tk-section-message>New members get access in about an hour.</tk-section-message>
<tk-section-message tone="neutral">Drafts are saved for 30 days.</tk-section-message>
<tk-section-message tone="success">Your calendar is connected.</tk-section-message>
<tk-section-message tone="warning">Vacation mode is on. You won't get alerts.</tk-section-message>
<tk-section-message tone="error">We couldn't save your changes. Try again.</tk-section-message>
  • info (default): information or advice.
  • neutral: a quiet note of low importance.
  • success: an action completed.
  • warning: a caution before or during an action.
  • error: an action failed or something needs fixing.

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. In high contrast the block also gets a 1px border.

Icon

Prices include VAT. Saved to your reading list.
<tk-section-message hide-icon>Prices include VAT.</tk-section-message>
<tk-section-message tone="success">
  <tk-icon slot="icon" name="bookmark"></tk-icon>
  Saved to your reading list.
</tk-section-message>
  • hide-icon removes the icon.
  • A tk-icon in slot="icon" replaces it. It's hidden from screen readers like the default one.

Actions

Turn on notifications You won't get alerts until notifications are enabled for this browser. Enable Not now
<tk-section-message tone="warning">
  <span slot="title">Turn on notifications</span>
  You won't get alerts until notifications are enabled for this browser.
  <tk-button slot="actions" size="small">Enable</tk-button>
  <tk-link slot="actions" treatment="quiet" href="/settings">Not now</tk-link>
</tk-section-message>
  • Put a secondary or ghost tk-button or a quiet tk-link in slot="actions". Don't use outline; its border disappears on the neutral tint.
  • Use at most one main and one secondary action. If you need more, use a dialog or a page.

Dismiss

Upload failed The file is larger than 25 MB.
<tk-section-message tone="error" dismissible>
  <span slot="title">Upload failed</span>
  The file is larger than 25 MB.
</tk-section-message>

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

  • Don't make a message dismissible if the user must resolve it. A notice about a failed action can be dismissible.
  • The ✕ disappears with the message, so move focus somewhere sensible after it closes.