Skip to content

Alert dialog

Asks the user to confirm an important or destructive action before it happens. Clicking outside doesn't close it, and it comes in danger, warning, success and info tones.

// Radix — @radix-ui/react-alert-dialog
import { AlertDialog } from "@shavin/ui";

Intents

Intent alerts

Component Source
import { AlertDialog, Button } from "@shavin/ui";

{/* 1. Default alert */}
<AlertDialog
  open={defaultOpen}
  onOpenChange={setDefaultOpen}
  title="Sign out?"
  description="You'll need to sign in again to access your account."
  confirmLabel="Sign out"
  onConfirm={() => setDefaultOpen(false)}
/>

{/* 2. Destructive alert */}
<AlertDialog
  open={destructiveOpen}
  onOpenChange={setDestructiveOpen}
  title="Delete permanently?"
  description="This item will be deleted forever."
  intent="danger"
  confirmLabel="Delete"
  onConfirm={() => setDestructiveOpen(false)}
/>

Centered status

Subscription expiring

Component Source
<AlertDialog
  open={open}
  onOpenChange={setOpen}
  layout="centered"
  intent="danger"
  icon={<Bell className="h-6 w-6" />}
  title="Subscription expiring soon"
  badgeText="Expires in 2 days"
  description="Your current plan will expire in 2 days. Update your payment method now to ensure uninterrupted access to your Pro features."
  confirmLabel="Update Payment"
  cancelLabel="Remind Me Later"
  onConfirm={() => setOpen(false)}
/>

Update available

Component Source
<AlertDialog
  open={open}
  onOpenChange={setOpen}
  layout="centered"
  intent="info"
  icon={<ShieldAlert className="h-6 w-6" />}
  title="Update available"
  badgeText="Release v28.1.0 (2026-01-12)"
  description="A new version of the application is ready. Restarting now will apply the latest security patches and features."
  confirmLabel="Update Now"
  cancelLabel="Remind Me Later"
  onConfirm={() => setOpen(false)}
/>

Props

PropTypeDefaultDescription
open*boolean—Whether alert dialog is open.
onOpenChange*(open: boolean) => void—Callback fired when open state changes.
title*string—Title of the alert dialog.
descriptionReactNode—Optional body description element.
confirmLabelstringConfirmConfirm action button label. Default 'Confirm'.
cancelLabelstringCancelCancel action button label. Default 'Cancel'.
onConfirm*() => void—Callback fired when user clicks confirm button.
dangerboolean—Styles confirm action as danger. Deprecated: use intent='danger'.
intent"info" | "warning" | "success" | "danger" | "default"—Visual intent/tone: info, warning, success, danger, default.
layout"default" | "centered"(left-aligned)Layout alignment: default (left-aligned) or centered.
badgeTextstring—Optional badge text below title.
iconReactNode—Optional custom icon element override.
childrenReactNode—Children element slot.

* required

Configure Theme
Theme
Brand Color
Custom
Gray Family
Appearance
Radius
Scaling
Panel Style
Heading Font
Body Font