Skip to content
Magma Design System
Modal<mds-modal>Generated from @maggioli-design-system/magma@2.3.0dist/documentation.json. Encapsulation: shadow.
Magma components are web components: custom elements you write like HTML tags, with any framework or without one. Props configure them, events tell you what happened, methods are functions you call on the element and slots take the content you put inside it.
Props
Set a prop as an HTML attribute in the markup, or as a property from JavaScript. The Attribute column gives the name of the attribute, a dash when it is the same as the property; props without one, such as arrays and functions, are set from JavaScript only. To turn a boolean attribute off, remove it: never write disabled="false".accessibleNamearia-labelstring | undefinedThe accessible name of the modal: the name a screen reader announces when the window opens. The <dialog> this component renders is the dialog, so the name goes there.
animation - 3d | custom | slide | undefinedslideSpecifies the animation style of the modal window
hideBackdrophide-backdropboolean | undefinedfalseHides the modal backdrop
interaction - relaxed | strictrelaxedSpecifies if the component can be closed with close button, or also if the backdrop background is cliccked. If strict is selected only the close button can dismiss the component via UI. If relaxed is selected the component can be dismissed also by cliccking the backdrop area.
opened - boolean | undefinedfalseSpecifies if the modal is opened or not
overflow - auto | manualautoSpecifies if the component prevents the body from scrolling when modal window is opened
position - bottom | bottom-left | bottom-right | center | left | right | top | top-left | top-right | undefinedcenterSpecifies the animation position of the modal window
Events
mdsModalClosevoidEmits when a modal is closed
mdsModalHidevoidEmits when a modal is totally invisible, can be useful to detach the component when it’s hidden and gain memory
mdsModalOpenvoidEmits when a modal is closed
mdsModalShowvoidEmits when a modal is totally visible, when the modal intro animation is finished
Methods
closeclose() => Promise<void>Closes the modal.
Slots
Slots take the content you write between the tags of the component. The default slot, the one without a name, accepts plain text, unless its description says otherwise. Content for a named slot goes on a direct child with the name of the slot in its slot attribute, such as slot="bottom".(default)Contents that will be placed in the center of the window. Add text string, HTML elements or components to this slot.
No slot name
bottomContents that will be placed on bottom of the window. Add text string, HTML elements or components to this slot.
topContents that will be placed on top of the window. Add text string, HTML elements or components to this slot.
windowUse directly a window component if you need it. Add text string, HTML elements or components to this slot.