Search documentation

Search the documentation and open a page.

A modal dialog that interrupts the user with important content and expects a response.

Loading...

Installation

pnpm dlx shadcn@latest add @wirekyt/alert-dialog

Composition

AlertDialog ├── AlertDialogTrigger └── AlertDialogContent ├── AlertDialogHeader │ ├── AlertDialogMedia (optional) │ ├── AlertDialogTitle │ └── AlertDialogDescription └── AlertDialogFooter ├── AlertDialogCancel └── AlertDialogAction

Examples

Default

Loading...

Destructive

Loading...

Small With Media

Loading...

Small

Loading...

With Media

Loading...

API Reference

AlertDialog

PropTypeDefaultDescription
idstring | undefined—Unique identifier used to connect the component parts.
idsElementIds | undefined—Overrides generated identifiers for individual parts.
trapFocusboolean | undefined—Configures trap focus.
preventScrollboolean | undefined—Configures prevent scroll.
modalboolean | undefined—Configures modal.
initialFocusEl(() => MaybeElement) | undefined—Configures initial focus el.
finalFocusEl(() => MaybeElement) | undefined—Configures final focus el.
restoreFocusboolean | undefined—Configures restore focus.
closeOnInteractOutsideboolean | undefinedtrueConfigures close on interact outside.
closeOnEscapeboolean | undefinedtrueConfigures close on escape.
role"dialog" | "alertdialog" | undefined—Configures role.
openboolean | undefined—Whether the component is open when controlled.
defaultOpenboolean | undefined—Initial open state when uncontrolled.
onOpenChange((details: OpenChangeDetails) => void) | undefined—Runs when open changes.
triggerValuestring | null | undefined—Configures trigger value.
defaultTriggerValuestring | null | undefined—Configures default trigger value.
onTriggerValueChange((details: TriggerValueChangeDetails) => void) | undefined—Runs when trigger value changes.

Context, Hooks, and Types

ExportAPI
AlertDialogContextRender-prop component that exposes component state and actions.
AlertDialogRootProviderProvides an externally created API to the component tree.
useAlertDialogCreates or accesses the component API.
useAlertDialogContextReturns the nearest component API.
AlertDialogOpenChangeDetailsType for the details object passed to the matching change callback.