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

Default

Trigger

Prop

Type

Default

Prop

Type

Default

Title

Prop

Type

Default

Description

Prop

Type

Default

Prop

Type

Default

Close

Prop

Type

Default

Last updated on