Skip to main content

BwModal | bw-modal

Overview

Modals are used to display content in a floating overlay at the center of the screen.

Usage

Basic

Open Modal

Hello

<bw-modal>
<bw-button slot="trigger">Open Modal</bw-button>
<div slot="content">
<p>Hello</p>
</div>
</bw-modal>

Properties

PropertyAttributeDescriptionTypeDefault
backdropDismissbackdrop-dismissBackdrop will close the modal on click when enabledbooleantrue
destroydestroyExecute a callback after the modal has dismissed() => void | Promise<void>undefined
initinitExecute a callback before the modal starts presenting() => void | Promise<void>undefined
openopenOpens and closes modalbooleanfalse
sizesizeThe size of the modal"lg" | "md" | "sm" | "xl" | "xs"'md'

Events

EventDescriptionType
modalDismissEmits whenever the modal has finished closing. Emits the role and optional data object passed to the closeModal() method.CustomEvent<{ role?: string; data?: any; }>
modalPresentEmits whenever the modal has opened. Does not emit any dataCustomEvent<any>
readyEmits when the popover has completed it's initial renderCustomEvent<any>

Methods

dismiss(role?: string, data?: any) => Promise<void>

Dismisses the modal

Parameters

NameTypeDescription
rolestring- The role of the modal
dataany- The data of the modal

Returns

Type: Promise<void>

present() => Promise<void>

Presents the modal

Returns

Type: Promise<void>

Slots

SlotDescription
"content"The content of the modal
"footer"The footer of the modal
"header"The header of the modal
"trigger"The trigger for the modal

Shadow Parts

PartDescription
"dialog"The dialog element of the modal
"inner-container"The inner container of the dialog element

CSS Custom Properties

NameDescription
--backgroundThe background color of the modal
--borderThe border of the modal
--colorThe color of the modal
--radiusThe radius of the modal

Dependencies

Used by

Graph


© 2025 United Systems & Software - All Rights Reserved.