Dialog
A window overlaid on either the primary window or another dialog window, this could be used for the modal interactions.
Import
import { Dialog, DialogTrigger, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogBody,DialogFooter, DialogClose } from "@sparrowengg/twigs-react";Usage
const DialogExample = () => {
return (
<Dialog>
<DialogTrigger asChild>
<Button size="lg">Edit profile</Button>
</DialogTrigger>
<DialogContent>
<DialogHeader>
<DialogTitle size="md">Edit profile</DialogTitle>
<DialogDescription>
Make changes to your profile here. Click save when done.
</DialogDescription>
</DialogHeader>
<DialogBody>
{/* Your content here */}
</DialogBody>
<DialogFooter>
<DialogClose asChild>
<Button size="lg" color="primary">
Save changes
</Button>
</DialogClose>
</DialogFooter>
</DialogContent>
</Dialog>
);
};Props
Dialog
| Prop | Type | Default |
|---|---|---|
defaultOpen? | boolean | false |
open? | boolean | - |
onOpenChange? | (open: boolean) => void | - |
size? | 'sm' | 'md' | 'lg' | 'xl' | 'full' | 'md' |
scrollBehavior? | 'auto' | 'scroll' | 'hidden' | 'auto' |
css? | object | - |
DialogContent
| Prop | Type | Default |
|---|---|---|
overlayClassName? | string | - |
portalContainer? | HTMLElement | - |
DialogTitle
| Prop | Type | Default |
|---|---|---|
size? | 'md' | 'lg' | 'lg' |
Data Attributes
These props are used for the conditional rendering of the components
| Prop | Type | Default |
|---|---|---|
[data-state]? | 'open' | 'closed' | - |