overlaysbuilt on ui sdk
Dialog
A focused task over the page. Traps focus while open and returns it on close.
01 / usage
import { Dialog, DialogTrigger, DialogBackdrop, DialogContent, DialogTitle, DialogDescription, DialogClose } from '@mikestecker/strata/ui'
import {
Button,
Dialog,
DialogBackdrop,
DialogClose,
DialogContent,
DialogDescription,
DialogTitle,
DialogTrigger,
} from '@mikestecker/strata/ui'
export default function DialogDemo() {
return (
<Dialog>
<DialogTrigger render={<Button variant="secondary" />}>Rename project</DialogTrigger>
<DialogBackdrop />
<DialogContent>
<DialogTitle>Rename project</DialogTitle>
<DialogDescription>The new name shows everywhere the project is listed.</DialogDescription>
<div style={{ display: 'flex', gap: 12, justifyContent: 'flex-end' }}>
<DialogClose render={<Button variant="ghost" />}>Cancel</DialogClose>
<DialogClose render={<Button />}>Save name</DialogClose>
</div>
</DialogContent>
</Dialog>
)
}02 / parts
DialogDialogTriggerDialogBackdropDialogContentDialogTitleDialogDescriptionDialogClose
03 / keyboard
- Enter or Space on the trigger opens it.
- Tab stays inside while it’s open.
- Escape closes it and returns focus to the trigger.
04 / agents
An agent opens and closes it, and its title names it.