Skip to content

Early previewhamur is not on npm yet. The components are being built in the open, follow along on GitHub.

UIComponentsReact

Alert Dialog

A dialog that interrupts the reader with something important and waits for an answer.

Built on the headless Alert Dialog.See its API in Docs

Rendered by React 19.3.1

alert-dialog.tsx

Installation

npx shadcn@4.23.0 add https://hamur.dev/r/react/alert-dialog.json

It also adds utils, button. The app needs its setup first: Installation.

Usage

AlertDialog holds AlertDialogTrigger and AlertDialogContent; put AlertDialogHeader (with AlertDialogTitle, AlertDialogDescription and, for an icon, AlertDialogMedia) and AlertDialogFooter (with AlertDialogCancel and AlertDialogAction) inside the content. size="sm" makes the content narrow. The content brings its own portal and overlay in React, Vue, Svelte and Solid; in Angular the template writes uiAlertDialogPortal itself. Unlike a Dialog, a click outside does not close it, and focus moves into it; both come from the headless Alert Dialog.

import {
  AlertDialog,
  AlertDialogAction,
  AlertDialogCancel,
  AlertDialogContent,
  AlertDialogDescription,
  AlertDialogFooter,
  AlertDialogHeader,
  AlertDialogMedia,
  AlertDialogOverlay,
  AlertDialogPortal,
  AlertDialogTitle,
  AlertDialogTrigger,
} from '@/components/ui/alert-dialog'

Examples

Default

A trigger, a title, a description, and Cancel and Continue.

Its preview and code are at the top of the page.

API reference

The styled parts pass every prop to the headless part they wrap and add classes. The props, data attributes and keyboard are on Alert Dialog's API reference.