Skip to main content

Dialog

Quick start

Here's a quick start guide to get started with the dialog component

Importing Component

import { Dialog } from "@hover-design/react";

Code Snippets and Examples

Simple Dialog
import { Dialog, Label, Input, Flex, Button } from "@hover-design/react";

function Demo() {
const [isOpen, setIsOpen] = useState(false);
<Button onClick={()=>{setIsOpen(true)}}>Open Dialog</Button>
<Dialog
isOpen={isOpen}
onClose={() => {
setIsOpen(false);
}}
>
{/* Dialog content */}
</Dialog>;
}
Customizing Dialog

You can customize the base styles of the dialog by passing in the styles props. Refer this table for its values:

styles

PropertyDescriptionDefault
backgroundColorBackground of Baseunset
zIndexZ Index10
positionPositionrelative
transformTransformtranslate(-50%, -50%)
topTopunset
leftLeft24px
rightRight24px
bottomBottomunset
paddingPadding12px
widthWidthauto
heightheightauto
boxShadowBox Shadow0 0 10px rgba(0, 0, 0, 0.5)
borderRadiusBorder Radius4px

Props Referece

AttributesValuesOptional ?
isOpenbooleanNo
onClose()=> voidNo
isCloseIconVisiblebooleanYes
closeOnClickOutsidebooleanYes
stylesstyles ObjectYes