Twigs Logo

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

PropTypeDefault
defaultOpen?
boolean
false
open?
boolean
-
onOpenChange?
(open: boolean) => void
-
size?
'sm' | 'md' | 'lg' | 'xl' | 'full'
'md'
scrollBehavior?
'auto' | 'scroll' | 'hidden'
'auto'
css?
object
-

DialogContent

PropTypeDefault
overlayClassName?
string
-
portalContainer?
HTMLElement
-

DialogTitle

PropTypeDefault
size?
'md' | 'lg'
'lg'

Data Attributes

These props are used for the conditional rendering of the components

PropTypeDefault
[data-state]?
'open' | 'closed'
-