Modal#

Github

Modal is a type of dialog element within user interface elements, commonly used to assist users in completing tasks without leaving the current page.

import { Modal } from "wis/modal"

API Reference#

NameTypeDefaultDescription
titlestringnoneModal header text, displayed at the top of the module.
descriptionstringnoneModal description text, displayed in the drawer header.
toggleTipReactNodenoneThe toggle tip.
widthnumbernoneSet the modal width.
heightnumbernoneSet the modal height.
closeablebooleantrueSet whether to display the close icon in the Modal.
maskCloseablebooleantrueEnable closing the Modal by clicking the overlay mask.
modalbooleantrueConfigure whether the popup is in modal mode.
openbooleannoneControlled open state of the Modal. Must be used with onOpen.
defaultOpenbooleannoneInitial open state of the Modal when first rendered.
onOpen(open: boolean) => voidnoneEvent handler called when the Modal's open state changes.

Method#

import { useRef } from "react" import { Modal, type ModalRef } from "wis/modal" import { Button } from "wis/button" function () { const modal = useRef<ModalRef>(null); return ( <> <Button text="Open" onClick={() => modal.current?.show()} /> <Modal ref={modal} title="Modal Title" /> </> ) }

Type Definition

interface ModalRef { show: () => void; hide: () => void; }

show(): void#

show Modal

hide(): void#

hide Modal