Skip to Content

Modal

The Modal component renders a dialog overlay. It is fully controlled — manage isOpen and onClose in your own state.

Preview

Interactive

Import

import { Modal } from '@chloe0592/pebble'

Usage

function Example() { const [open, setOpen] = useState(false) return ( <> <Button onClick={() => setOpen(true)}>Open modal</Button> <Modal isOpen={open} onClose={() => setOpen(false)} title="Confirm action" description="Are you sure you want to proceed?" footer={ <> <Button variant="ghost" onClick={() => setOpen(false)}>Cancel</Button> <Button variant="primary" onClick={() => setOpen(false)}>Confirm</Button> </> } > <p>Optional body content goes here.</p> </Modal> </> ) }

Props

PropTypeDefaultDescription
isOpenbooleanControls whether the modal is visible
onClose() => voidCalled when the modal requests to close
titlestringHeading displayed at the top of the modal
descriptionstringSubheading below the title
footerReactNodeContent rendered in the footer (typically buttons)
size'sm' | 'md' | 'lg' | 'full''md'Modal width
closeOnBackdropbooleantrueWhether clicking the backdrop closes the modal
Last updated on