@codecraftkit
Documentation
The Modal as the name suggests is used to create Modals.
This component is based on Modal
it can be imported from the core.
import { Modal } from "@codecraftkit/core";
or alone.
import Modal from "@codecraftkit/modal";
We recommend to use the hook useDisclosure from Chakra ui, to manage the modal states
function MyApp() {const {isOpen, onOpen, onClose} = useDisclosure();return (<><Button size='xs' onClick={onOpen}>Open Modal</Button><Modaltitle='Modal Title'buttonText='New'body={<Grid placeItems="center" h="500px">Text Inside The Modal</Grid>}closeOnOverlayClick={false}onOpen={onOpen}isOpen={isOpen}onClose={onClose}/></>)}
title
String
no
The title of the Modal
body
Component
String
no
Component that will be the content of the Modal
isOpen
Boolean
Yes
false
specify if the modal is open or closed
size
xs
sm
md
lg
xl
full
no
xl
specify if the size of the modal
boxSize
px
%
em
rem
no
specify if the size of the modal, in any unit
motionPreset
String
no
Animation Type
onClose
Function
yes
Call when the component is closing
closeOnOverlayClick
Boolean
no
false
Specifies whether or not the modal is closed when you click outside it.
closeOnESC
Boolean
no
false
Specifies whether the modal is closed when the ESC key is pressed.
isDisabled
Boolean
no
false
specify when the close button of the modal is disabled or not
modalContentStyles
Object
no
Customize Modal Content Styles
modalBodyStyles
Object
no
Customize Modal Body Styles
modalHeaderStyles
Object
no
Customize Modal Header Styles
modalExtraProps
Object
no
Send props to Chakra Modal