Skip to content

LiveRegion

Feedback

Accessible status announcements with a hook for repeated messages.

Visible statusRepeated announcements
Open preview

Responsive viewport — resize the window to explore. Direction and density apply only to this preview. Theme applies to the docs too.

Usage

Mount a LiveRegion before changing its message. useAnnouncer returns message, announce, and clear; it makes repeated identical announcements detectable.

Import
import {
  LiveRegion,
  useAnnouncer,
} from "@dashboardpack/core/components/ui/live-region";

Available in the included @dashboardpack/core package. Copy the complete example from Source code for all imports and state. Add "use client" when using hooks or event handlers. See installation and theming for project setup.

API reference

Common props and defaults. Slot-specific props are named below; native elements also accept their standard HTML attributes. The component TypeScript definitions are the complete type reference.

LiveRegion props
PropType / DefaultDescription
politenesspolite | assertive

Default: polite

Announcement priority and status/alert role.
atomicboolean

Default: true

Announce the whole message after changes.
visibleboolean

Default: false

Render visible text instead of screen-reader-only content.
childrenReactNode

Default: —

Current status message.

Build with these too