Component libraryAlert dialog
Alert dialog
ProConfirm an action with clear cancel and confirm controls.
npx shadcn@latest add @tidal-pro/alert-dialogInstallation
Pro source is gated. Configure the @tidal-pro registry using the agent guide. Create an access key from your account after purchasing.
Terminal
Import components/ui/tidal.css, components/ui/alert-dialog.css, then add the component inside a tidal-scope wrapper. Its scoped design tokens keep it independent of your existing CSS.
Usage
Complete example source · Dependency and asset manifest
Loading the complete example…
API & behavior
open and onOpenChange form the required controlled visibility contract. trigger is a consumer-owned React element wrapped with Radix asChild, so its native attributes and ref remain available and focus returns to it when the dialog closes. Required title and description label an explicit alertdialog through generated stable IDs; optional detail preserves numeric zero. cancelLabel, confirmLabel and optional busyLabel are consumer content. onCancel receives the native cancel, Escape or pointer-outside event plus its reason; onConfirm receives the native button event. Native button handlers run first and prevention suppresses the higher callback. busy, disabled and per-action disabled props disable the appropriate native actions; busy also exposes aria-busy. Initial focus selects the enabled cancel action, then the dialog container when cancel is unavailable, and never selects the confirm action by default. escapeCancels defaults true; outsidePointerCancels defaults false. Both channels remain open until the consumer updates open, and busy or disabled ignores them. tone, theme, dir, portalContainer and actionsLabel configure presentation. Cancel and confirm prop bags preserve native form/button attributes while excluding conflicting disabled and ARIA-disabled values; separate refs target each button. Overlay and content prop bags forward compatible native Radix attributes and caller handlers while the component owns role, labels and children. The forwarded component ref targets the dialog content. Consumers own every confirmation effect, pending state and focus destination after external state changes; the component performs no mutation, request, navigation, storage or backend action.
Style with the --t-* CSS variables. Set data-theme="dark" on your tidal-scope wrapper for a dark surface. Motion respects the system’s reduced-motion preference.