Skip to content

Notification

Inline message card for system events, with optional icon, timestamp, actions, and dismiss control.

  • stable
  • since v0.1.0
  • 3.8 kB
  • feedback
  • notification
  • status

Notification renders a <div> card and lets the surrounding app decide on live-region semantics. The dismiss button is rendered via IconButton and labelled by dismissLabel (defaults to Dismiss notification).

Preview
Open
tsx

Pass any node to icon for a leading glyph and a string or node to timestamp for an aligned trailing time.

Preview
Open
tsx

Pass unread to render the unread indicator dot. The optional onRead callback fires when the card is clicked so consumers can mark the notification as read.

Preview
Open
tsx

The actions slot accepts any node — typically a row of Buttons for inline responses.

Preview
Open
tsx

Set onDismiss to render the close IconButton. Use dismissLabel to override the default "Dismiss notification" label.

Preview
Open
tsx
PropTypeDefaultDescription
icon
ReactNode
Leading icon node.
title
ReactNode
Headline content. Mutually composes with `description` and `timestamp`.
description
ReactNode
Supporting body content rendered below the title.
timestamp
ReactNode
Right-aligned timestamp shown next to the title.
actions
ReactNode
Inline action row rendered beneath the description.
unread
boolean
false
Marks the notification as unread; renders an accent dot and triggers `onRead` on the next click.
onRead
(() => void)
Invoked when an unread notification is clicked.
onDismiss
(() => void)
Invoked when the user activates the dismiss control. When omitted, no dismiss button is rendered.
dismissLabel
string
Dismiss notification
Accessible label for the dismiss button.
  • The card itself is not a live region — wrap a stack of notifications in role="status" or role="log" when announcements are needed.
  • The dismiss control is an IconButton whose label is dismissLabel — defaults to "Dismiss notification".
  • The unread dot is decorative (aria-hidden="true"); pair it with a visible label such as “Unread” when state matters.
  • Clicking the card triggers onRead when unread is set, so non-pointer users should also be able to mark items read via an explicit control.
  • Use a heading element inside title (or nest your own heading) when the notification sits at the top of a region.
  • Stack notifications inside a fixed-position container to build a notification centre.
  • Auto-dismiss informational notifications after a few seconds; keep dangerous ones manual.
  • Pair a primary action with a “Mark as read” secondary button inside actions.
  • Use a leading Avatar as the icon for activity feeds.