Dialog playground
A controlled modal dialog with named content, keyboard containment, focus restoration, and a busy dismissal guard.
Preview
Props editor
State matrix
| Variant | Default |
|---|---|
| Sample |
Published example
API reference'use client'
import { useState } from 'react'
import { Button, Dialog } from '@ancrel/ui'
import '@ancrel/tokens/css'
import '@ancrel/ui/styles.css'
export default function App() {
const [open, setOpen] = useState(false)
const [busy, setBusy] = useState(false)
return <>
<Button onClick={() => setOpen(true)}>Review changes</Button>
<Dialog open={open} onOpenChange={setOpen} busy={busy} title="Publish changes"
description="Review the summary before publishing."
footer={<Button onClick={() => setBusy(!busy)}>{busy ? 'Finish' : 'Start review'}</Button>}>
<p>Two pages have changed.</p>
</Dialog>
</>
}