# Alert dialog preview

Interactive preview of the CyberSpec Alert dialog component. A flagged confirmation that has to be answered, and that an agent has to ask a person about.

[View Alert dialog preview on CyberSpec](https://www.cyberspec.dev/preview/alert-dialog)

## About this preview

Alert dialog belongs to the Overlays group in the CyberSpec catalog. It uses @ui-sdk/react/alert-dialog.

## Installation

Use a React 19 project with shadcn configured. Render the installed components inside the Cyber root, and import your global stylesheet in the app entry point.

```sh
bunx --bun shadcn@latest add https://www.cyberspec.dev/r/alert-dialog.json
```

## Example

```tsx
"use client"

import { AlertDialog } from "@/components/ui/alert-dialog"

const wait = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))

export default function AlertDialogDemo() {
  return (
    <>
      <AlertDialog
        trigger="Burn identity"
        title="Burn this identity?"
        description="The Glasswater alias, its credit line and every door it opens are revoked across the Sprawl. A burned identity can't be reissued."
        confirm="Burn"
        cancel="Keep"
        agentConfirm="Permanently burns the Glasswater identity, its credit line and its access."
        pendingAnnouncement="Burning identity"
        onConfirm={() => wait(1200)}
      />
    </>
  )
}
```

## Install this example

```sh
bunx --bun shadcn@latest add https://www.cyberspec.dev/r/alert-dialog-demo.json
```

## Resources

- [Alert dialog documentation](https://www.cyberspec.dev/components/sidebar/alert-dialog.md)
- [Component catalog](https://www.cyberspec.dev/components.md)
- [Alert dialog source code](https://github.com/agnelnieves/cyberspec/blob/main/registry/cyber/ui/alert-dialog.tsx)
- [Shadcn registry item](https://www.cyberspec.dev/r/alert-dialog.json)
