useImperativeAlertDialog@astryxdesign/core v0.5.2 · useImperativeAlertDialog

Install with shadcn

Experimental compatibility. This installs the real Astryx package and creates a local public re-export; it does not copy component implementation source. How compatibility works.

This install URL expires with the draft preview.
bash
npx shadcn@latest add https://astryx-2z5i6c2u1-fbopensource.vercel.app/r/astryx-component-use-imperative-alert-dialog.json
Install the editable showcase composition
bash
npx shadcn@latest add https://astryx-2z5i6c2u1-fbopensource.vercel.app/r/astryx-showcase-alert-dialog-delete-confirmation.json

Usage

Hook for showing an alert dialog without managing open state. Call alert.show(options) to open and alert.hide() to close. Render alert.element in your JSX tree.

ts
import {useImperativeAlertDialog} from '@astryxdesign/core/AlertDialog'

Parameters

ParamTypeDescription
show
(options: AlertDialogOptions) => void

Show the alert dialog with the given options. Options are the same as AlertDialog props minus isOpen/onOpenChange.

hide
() => void

Hide the alert dialog.

isOpen
boolean

Whether the dialog is currently open.

element
ReactNode

The dialog element: render this in your JSX tree.

Examples

Common configurations, variations, and states.
AlertDialog — Delete
Open in Playground

A delete button that asks the user to confirm before deleting.