Skip to content

Alert Dialog

A modal confirmation with explicit choices.

Upstream documentation

Examples

Sample unchanged

Installation

Run the Ninaero registry command to install the component and its dependencies, including shared theme styles.

Install Alert Dialog
pnpm dlx shadcn@latest add 'https://ninaero.pages.dev/r/alert-dialog.json'

Usage

A complete example using the installed component and hook paths.

Alert Dialog usage
"use client";import { useState } from "react";import { AlertDialog, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger } from "@/components/ui/alert-dialog";import { Button } from "@/components/ui/button";function AlertDialogPreview() {  const [confirmed, setConfirmed] = useState(false);  return (    <div className="space-y-2">      <AlertDialog>        <AlertDialogTrigger render={<Button variant="outline" />}>Reset sample</AlertDialogTrigger>        <AlertDialogContent>          <AlertDialogHeader>            <AlertDialogTitle>Reset this sample?</AlertDialogTitle>            <AlertDialogDescription>              This changes only the local example state.            </AlertDialogDescription>          </AlertDialogHeader>          <AlertDialogFooter>            <AlertDialogCancel>Cancel</AlertDialogCancel>            <AlertDialogCancel variant="default" onClick={() => setConfirmed(true)}>              Reset sample            </AlertDialogCancel>          </AlertDialogFooter>        </AlertDialogContent>      </AlertDialog>      <p aria-live="polite" className="text-xs text-muted-foreground">        {confirmed ? "Sample reset" : "Sample unchanged"}      </p>    </div>  );}export default function Demo() {  return <AlertDialogPreview />;}

API Reference

Ninaero exports and local defaults are listed below. See the upstream reference for inherited primitive props and additional composition examples.

AlertDialog

AlertDialog props
AlertDialogPrimitive.Root.Props

AlertDialogAction

AlertDialogAction props
React.ComponentProps<typeof Button>
size
"lg"

AlertDialogCancel

AlertDialogCancel props
AlertDialogPrimitive.Close.Props &  Pick<React.ComponentProps<typeof Button>, "variant" | "size"> & { sound?: boolean }
variant
"secondary"
size
"lg"
sound
true

AlertDialogContent

AlertDialogContent props
AlertDialogPrimitive.Popup.Props & {  size?: "default" | "sm";}
size
"default"

AlertDialogDescription

AlertDialogDescription props
React.ComponentProps<typeof AlertDialogPrimitive.Description>

AlertDialogFooter

AlertDialogFooter props
React.ComponentProps<"div">

AlertDialogHeader

AlertDialogHeader props
React.ComponentProps<"div">

AlertDialogMedia

AlertDialogMedia props
React.ComponentProps<"div">

AlertDialogOverlay

AlertDialogOverlay props
AlertDialogPrimitive.Backdrop.Props

AlertDialogPortal

AlertDialogPortal props
AlertDialogPrimitive.Portal.Props

AlertDialogTitle

AlertDialogTitle props
React.ComponentProps<typeof AlertDialogPrimitive.Title>

AlertDialogTrigger

AlertDialogTrigger props
AlertDialogPrimitive.Trigger.Props & { sound?: boolean }
sound
true

Source

Registry JSON