A modal dialog that interrupts the user with important content and expects a response. Plays open and close sounds.
A modal dialog that interrupts the user with important content and expects a response. The sensory-ui AlertDialog plays sounds on open and close, signaling the shift in focus to the modal.
Pattern: Open / close
npx shadcn@latest add SatyamVyas04/sensory-ui/sensory-ui-alert-dialogimport {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger,
} from "@/components/ui/sensory-ui/alert-dialog";| Prop | Type | Default | Description |
|---|---|---|---|
sound | SoundRole | false | "overlay.open" | Sound played when the dialog opens. |
closeSound | SoundRole | false | "overlay.close" | Sound played when the dialog closes. |
volume | number | 1 | Per-component volume multiplier (0–1). |
overlay.open on open, overlay.close on close.
<AlertDialog>
<AlertDialogTrigger>Open</AlertDialogTrigger>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Are you sure?</AlertDialogTitle>
<AlertDialogDescription>
This action cannot be undone.
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogAction>Continue</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog><AlertDialog sound="notification.warning" closeSound="interaction.subtle">
{/* ... */}
</AlertDialog><AlertDialog sound={false} closeSound={false}>
{/* ... */}
</AlertDialog><AlertDialog sound="notification.warning" closeSound="overlay.close">
<AlertDialogTrigger>Delete account</AlertDialogTrigger>
<AlertDialogContent>
{/* Warning content */}
</AlertDialogContent>
</AlertDialog><AlertDialog sound="notification.info" closeSound="interaction.subtle">
<AlertDialogTrigger>View details</AlertDialogTrigger>
<AlertDialogContent>
{/* Info content */}
</AlertDialogContent>
</AlertDialog>| Prop | Value |
|---|---|
sound | "overlay.open" |
closeSound | "overlay.close" |
volume | 1 |
| Situation | Recommended Sound | Why |
|---|---|---|
| Destructive action | notification.warning | Warns of consequence |
| Informational alert | notification.info | Neutral, informative |
| Success confirmation | notification.success | Positive reinforcement |
| Generic modal | overlay.open / overlay.close | Default: clear overlay cue |
| Event | Default Sound |
|---|---|
| Dialog opens | overlay.open |
| Dialog closes | overlay.close |
View the original Alert Dialog documentation.