Modal
Display a separate dialog to focus attention on the current task.
Usage guide
#Use when users must pause their current task to confirm a decision or complete limited input. Use Popconfirm for brief confirmations and Modeless for parallel work.
Present the information needed for a decision
Separate
header,body, andfooterslots, and describe actions clearly withokTextandcancelText. UsehideFooterto hide the default footer.Open and close a dialog
Open with
setOpen()and finish withsetOk(),setCancel(), orsetClose().Handle the reason for closing
Read
ok,cancel, orclosefromclosed.detail.event, along withvalue.
Examples
#Feature examples
#Choose a feature from 22 topics. Explore property settings, method calls, event results, and slot layouts through live examples and code.
No matching features.
API reference
#Hover over a name or focus it with the keyboard to see the code. On touch screens, tap the name.
<sy-modal>
Properties
| Attribute / Property | Type | Default | Description |
|---|---|---|---|
string | '' | Cancel button text. | |
boolean | false | Show the close button. | |
boolean | false | Allow the dialog to be maximized. | |
boolean | false | Hide the default footer actions. | |
boolean | false | Close when the backdrop is clicked. | |
boolean | false | Omit the backdrop mask. | |
string | '' | Confirmation button text. | |
boolean | false | Whether the submenu is expanded. | |
number | 0 | Dialog width in pixels. 0 uses the default size. | |
number | 0 | Dialog height in pixels. 0 fits the content. | |
string | '-1' | Position from the top of the screen. -1 centers it automatically. | |
string | '-1' | Position from the left of the screen. -1 centers it automatically. | |
'modal' | 'dialog' | 'dialog' | modal or dialog style. | |
| 'none'
| 'fade' | 'fade-scale' | 'zoom' | 'pop'
| 'slide-top' | 'slide-bottom' | 'slide-left' | 'slide-right'
| 'slide-fade-top' | 'slide-fade-bottom' | 'slide-fade-left' | 'slide-fade-right'
| 'reveal-top' | 'reveal-bottom' | 'reveal-left' | 'reveal-right'
| 'flip-x' | 'flip-y' | 'bounce' | 'spin' | 'none' | Enter/exit animation type. `none` (default) toggles instantly. Direction-aware values are explicit (`slide-top`, `slide-fade-left`, `reveal-bottom`, …) because the modal has no `position` attribute to derive direction from. Direction-less values (`fade`, `pop`, `flip-*`, `bounce`, `spin`) play the same regardless of orientation. | |
'x-fast' | 'fast' | 'medium' | 'slow' | 'x-slow' | 'fast' | Animation playback speed token. Maps to `--transition-*` global tokens. |
Events
| Event | Detail | Description |
|---|---|---|
CustomEvent<{
event: 'ok' | 'cancel' | 'close';
value: any;
maximized: boolean;
position: { top: string; left: string };
}> | Fires when the modal closes. `detail.event` distinguishes ok / cancel / close. |
Methods
| Method | Returns | Description |
|---|---|---|
Promise<void> | Expand the submenu. | |
Promise<void> | Close the item. | |
Promise<void> | Close the dialog with a cancellation result. | |
Promise<void> | Close the dialog with a confirmation result. | |
Promise<void> | Maximize the window. |
Slots
| Slot | Description |
|---|---|
| Content displayed in the header area. | |
| Content displayed in the body area. | |
| Content displayed in the footer area. |