Skip to main content

Modal

The ty-modal component is used to display content in a modal dialog overlay. It supports a close icon and can be triggered to open or close programmatically.

Usage

Live Editor
<ty-modal open>
  <div slot="header">Modal Header</div>
  <div>Modal Content</div>
  <div slot="footer">Modal Footer</div>
</ty-modal>
Result
Loading...

API

Properties

NameDescriptionTypeDefault
openControls the visibility of modalBooleanfalse
showCloseIconDisplays a close icon in the modalBooleantrue
sizesize'sm', 'md', 'lg', 'xl'md'

Methods

MethodDescription
showModal()Opens the modal.
hideModal()Closes the modal.
handleCloseClick()Handles the action when the close icon or overlay is clicked.

Events

NameDescription
ty-closeEmitted when the modal is closed.