Alert
Displays a callout for user attention.
Heads up!
You can add components to your app using the CLI.
Error
Your session has expired. Please log in again.
Alert — bloc informatif inline (non-modal, ne bloque pas). Variantes default (info) et destructive (rouge). Pour un dialog bloquant utiliser AlertDialog ; pour un toast éphémère Toast.
Installation
$ bext ui add alert
Copy and paste the following into src/components/ui/alert.tsx.
Usage
Anatomy
<Alert> ├── <icon /> // optionnel ├── <AlertTitle>Title</AlertTitle> └── <AlertDescription>Body</AlertDescription> </Alert>
API Reference
Alert
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | "default" | "destructive" | "default" | undefined |
| children | ReactNode | — | undefined |
AlertTitle
| Prop | Type | Default | Description |
|---|---|---|---|
| children | ReactNode | — | Rendu comme font-medium. |
AlertDescription
| Prop | Type | Default | Description |
|---|---|---|---|
| children | ReactNode | — | Rendu comme text-sm text-muted-foreground. |
Accessibility
role="alert" par défaut — annoncé immédiatement aux AT. Ne pas abuser (le screen reader interrompt sa lecture). Pour un update passif, préférer role="status" aria-live="polite".
Edit this example live in the bext playground — it compiles and runs entirely in your browser.
The React idiom — same UI, for comparison.
On This Page