Skip to content
LoidoltTheme 0.11.1
Svelte 5

Component

LiveRegion

A status region that speaks changes to screen readers without moving focus.

import { LiveRegion } from '@loidolt/theme-svelte';

Example

Saved 0 times. Screen readers hear each save, even when the text repeats.

Notes

  • Mount it once and change message. A region inserted together with its text is silent in most screen readers.
  • Pair it with createAnnouncer(), which clears the region between messages so a repeated message is still announced, and empties it again after clearAfter so no stale text lingers.
  • politeness="assertive" interrupts the user — keep it for errors that need immediate attention.

Props

Generated from the component source, so it cannot drift from the implementation.

LiveRegion props
PropTypeDefaultNotes
atomic booleantrueRead the whole region on every change, not only the changed part.
children Snippet—Rendered after message, for richer content.
class string—
message string''Text to announce. Changing it is what triggers speech.
politeness Politeness'polite''polite' waits for a pause (role="status"); 'assertive' interrupts (role="alert").
ref bindableHTMLDivElement | nullnull
visuallyHidden booleantrueKeep the region off-screen. Set false to also show the message visually.

Plus the attributes of HTMLAttributes<HTMLDivElement>, forwarded to the root element.