Skip to content

Modal

<ts-modal> vv0.4.0

The ts-modal component.

Open in Storybook for interactive demos.

<ts-modal>Content</ts-modal>
PropertyAttributeTypeDefaultDescription
closeOnEscapeclose-on-escapebooleantrueWhether pressing Escape closes the modal.
closeOnOverlayclose-on-overlaybooleantrueWhether clicking the overlay closes the modal.
labellabelstring | undefinedLabel for accessibility (used as aria-label).
openopenbooleanfalseWhether the modal is open.
showCloseshow-closebooleantrueWhether to show the close button.
sizesize"lg" | "md" | "sm" | "xl" | "xs"'md'The modal’s width size preset.
EventDetailBubblesComposedDescription
tsClosevoidYesYesEmitted when the modal closes.
tsOpenvoidYesYesEmitted when the modal opens.
MethodSignatureDescription
closeclose() => Promise<void>Programmatically close the modal.
showshow() => Promise<void>Programmatically open the modal.
NameDescription
*(default)*Default slot for modal body content.
footerModal footer content (e.g., action buttons).
headerModal header content.

Use ::part() to style internal elements:

PartDescription
bodyThe body wrapper.
closeThe close button.
dialogThe dialog container.
footerThe footer wrapper.
headerThe header wrapper.
overlayThe backdrop overlay.
ts-modal::part(body) {
/* your custom styles */
}
<ts-modal>Content</ts-modal>
import { TsModal } from '@tessera-ui/react';
<TsModal closeOnEscape closeOnOverlay>Content</TsModal>