Dialog
Modal window that traps focus and blocks the page behind it.
Installation
import { Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger } from "@xerobi/ui/dialog"This component is client-side. In Astro, hydrate it with a client directive.
Examples
Default
import { Button } from "@xerobi/ui/button"
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from "@xerobi/ui/dialog"
export function DialogDefault() {
return (
<Dialog>
<DialogTrigger render={<Button variant="outline">Open dialog</Button>} />
<DialogContent>
<DialogHeader>
<DialogTitle>Rename project</DialogTitle>
<DialogDescription>The name is visible to everyone in your organization.</DialogDescription>
</DialogHeader>
<DialogFooter>
<Button>Save changes</Button>
</DialogFooter>
</DialogContent>
</Dialog>
)
}API reference
Dialog
Also accepts every prop of Base UI Dialog.
No props of its own.
DialogBody
Also accepts every prop of <div> element.
No props of its own.
DialogClose
No props of its own.
DialogContent
| Prop | Type | Description |
|---|---|---|
| showCloseButton | boolean |
DialogDescription
No props of its own.
DialogFooter
Also accepts every prop of <div> element.
| Prop | Type | Description |
|---|---|---|
| showCloseButton | boolean |
DialogHeader
Also accepts every prop of <div> element.
No props of its own.
DialogOverlay
No props of its own.
DialogPortal
No props of its own.
DialogTitle
No props of its own.
DialogTrigger
No props of its own.
Styling hooks: [data-slot="dialog"], [data-slot="dialog-trigger"], [data-slot="dialog-portal"], [data-slot="dialog-close"], [data-slot="dialog-overlay"], [data-slot="dialog-content"], [data-slot="dialog-header"], [data-slot="dialog-footer"], [data-slot="dialog-body"], [data-slot="dialog-title"], [data-slot="dialog-description"].