Skip to Content
MavKitOne is in beta. @mav-labs-inc/mavkit-react is not public packages yet.

Modal

A native <dialog>-backed overlay. Compose ModalHeader / ModalBody / ModalFooter as children for the .modal-header / .modal-body / .modal-footer regions — Modal finds .modal-title and .modal-close by class name, so it doesn’t need title/footer props of its own.

open is fully controlled: your onClose callback is called on the close button, a backdrop click, or Escape, and it’s up to you to actually flip open to false — not doing so vetoes the close.

Usage

import { Modal, ModalHeader, ModalBody, ModalFooter, Button } from '@mav-labs-inc/mavkit-react' const [isOpen, setIsOpen] = useState(false) <Modal open={isOpen} onClose={() => setIsOpen(false)}> <ModalHeader>My Modal</ModalHeader> <ModalBody> <p>Modal content goes here.</p> </ModalBody> <ModalFooter> <Button className="modal-action modal-action--primary">Save</Button> </ModalFooter> </Modal>

Example

Props

PropTypeDefaultDescription
open*boolean—Controlled open state. The modal animates closed when this flips to false.
onClose() => void—Called when the user attempts to close (close button, backdrop, ESC). Set open to false here to actually close — not doing so vetoes the close.
barebooleanfalseRenders via dialog.show() instead of showModal() — no backdrop, no body scroll lock, no native focus trap.
fullHeightbooleanfalseStretch the modal to the full viewport height.
fullWidthbooleanfalseStretch the modal to the full viewport width.
fixedbooleanfalsePin the modal to a fixed position rather than centering.
classNamestring—Extra class names for the <dialog> element.
childrenReactNode—

ModalHeader

PropTypeDefaultDescription
closeLabelstring'Close'aria-label for the generated .modal-close (×) button.
hideClosebooleanfalseOmit the .modal-close (×) button.
childrenReactNode—Rendered as the .modal-title.

Also accepts every native <div> attribute.

ModalBody / ModalFooter

Thin wrappers rendering a <div> with .modal-body / .modal-footer — accept every native <div> attribute, no extra props of their own.

Last updated on