Caprice LogoCaprice UI

Alert Dialog

A dialog that requires user response to proceed.

Installation

npx shadcn@latest add @caprice/alert-dialog

Usage

import * as AlertDialog from "@/components/caprice-ui/alertdialog"
<AlertDialog.Root>
  <AlertDialog.Trigger render={<Button>Discard draft</Button>} />

  <AlertDialog.Popup>
    <AlertDialog.Title>Discard draft?</AlertDialog.Title>
    <AlertDialog.Description>You can't undo this action.</AlertDialog.Description>
    <AlertDialog.Footer>
      <AlertDialog.Close>Cancel</AlertDialog.Close>
      <AlertDialog.Close variant="default">Discard</AlertDialog.Close>
    </AlertDialog.Footer>
  </AlertDialog.Popup>
</AlertDialog.Root>

Examples

Open from a menu

Close confirmation (nested dialogs)

API Reference

Root

Prop

Type

Trigger

Prop

Type

Prop

Type

Title

Prop

Type

Description

Prop

Type

Prop

Type

Close

Prop

Type