UNPKG

@wethegit/react-modal

Version:

A customizable, accessible modal window component for React projects.

57 lines (45 loc) 1.57 kB
import { JSX as JSX_2 } from 'react/jsx-runtime'; export declare function Modal({ renderTo, className, ...props }: ModalProps): JSX_2.Element; export declare function ModalBackdrop({ className, ...props }: ModalBackdropProps): JSX_2.Element; export declare interface ModalBackdropProps { className?: string; onClick?: () => void; } export declare function ModalContent({ className, ...props }: ModalContentProps): JSX_2.Element; export declare type ModalContentProps = React.HTMLAttributes<HTMLDivElement>; declare interface ModalInnerProps extends React.HTMLAttributes<HTMLDivElement> { /** * The content of the modal. */ children?: React.ReactNode; /** * The className of the modal. */ className?: string; } export declare interface ModalProps extends ModalInnerProps { /** * The modal will be appended to the passed element instead of being rendered in place * @defaultValue defaults inPlace **/ renderTo: HTMLElement; } export declare enum ModalStates { CLOSED = "closed", OPEN = "open" } export declare function useModal(props?: UseModalOptions): { isOpen: boolean; toggle: () => void; }; export declare interface UseModalOptions { /** * The ref of the element that should receive focus when the modal closes. */ triggerRef?: React.MutableRefObject<HTMLElement | null>; /** * If set, the modal will be opened/closed by updating the route hash. */ hash?: string; } export { }