UNPKG

@nex-ui/react

Version:

🎉 A beautiful, modern, and reliable React component library.

60 lines (57 loc) • 1.55 kB
import { ReactNode } from 'react'; type ModalProps = { children?: ReactNode; /** * If true, the Modal is shown. (controlled) */ open?: boolean; /** * If true, the Modal is shown by default. (uncontrolled) */ defaultOpen?: boolean; /** * Handler that is called when the Modal is opened or closed */ onOpenChange?: (open: boolean) => void; /** * The container element in which the overlay portal will be placed. * @default document.body */ container?: HTMLElement | null | (() => HTMLElement | null); /** * If true, always keep the children in the DOM. * @default false */ keepMounted?: boolean; /** * If true, closes the Modal when the outside is clicked. * @default true */ closeOnInteractOutside?: boolean; /** * If true, the Modal prevents page scrolling. * @default false */ preventScroll?: boolean; /** * If true, closes the Modal when the escape key is pressed. * @default true */ closeOnEscape?: boolean; /** * If true, the Modal will restore focus to previously focused element once the Modal is hidden or unmounted. * @default true */ restoreFocus?: boolean; /** * Callback function that is called when the Modal is closed. */ onClose?: () => void; }; interface ModalTriggerProps { children?: ReactNode; } interface ModalCloseProps { children?: ReactNode; } export type { ModalCloseProps, ModalProps, ModalTriggerProps };