Skip to content
h v3.13.3
Search the docs
Find a component, section or page.

Alert

Displays a callout for user attention.

Installation

pnpm add @heyramzi/ui

Usage

import * as Alert from "@heyramzi/ui/shadcn/alert";
<Alert.Root>
  <Alert.Title>Your changes have been saved</Alert.Title>
  <Alert.Description>This is an alert with a title and a description.</Alert.Description>
</Alert.Root>
<Alert.Root variant="destructive">
  <Alert.Title>Unable to process your payment.</Alert.Title>
</Alert.Root>

Keyboard and accessibility

  • Alert has role="alert", so a screen reader reads it out as soon as it appears.
  • For a message that's on the page from the start, pass role="status" or role={undefined} so it isn't read out of turn.

API reference

Alert.Root

variant "default" | "destructive"
Default "default"
ref bindable HTMLDivElement | null
Default null
class string
role string
Default "alert"
children Snippet
...rest
Every prop of HTMLAttributes<HTMLDivElement> from svelte/elements
Prop Type Default
variant "default" | "destructive" "default"
ref bindable HTMLDivElement | null null
class string
role string "alert"
children Snippet
...rest Every prop of HTMLAttributes<HTMLDivElement> from svelte/elements

Alert.Title

ref bindable HTMLDivElement | null
Default null
class string
children Snippet
...rest
Every prop of HTMLAttributes<HTMLDivElement> from svelte/elements
Prop Type Default
ref bindable HTMLDivElement | null null
class string
children Snippet
...rest Every prop of HTMLAttributes<HTMLDivElement> from svelte/elements

Alert.Description

ref bindable HTMLDivElement | null
Default null
class string
children Snippet
...rest
Every prop of HTMLAttributes<HTMLDivElement> from svelte/elements
Prop Type Default
ref bindable HTMLDivElement | null null
class string
children Snippet
...rest Every prop of HTMLAttributes<HTMLDivElement> from svelte/elements