Skip to content

Dialog

The bq-dialog component is a modal dialog overlay used for confirmations, forms, and focused interactions. It traps focus and supports keyboard dismissal.

Basic Usage

html
<bq-button onclick="document.querySelector('#my-dialog').open = true">
  Open Dialog
</bq-button>

<bq-dialog id="my-dialog" title="Confirm Action">
  <p>Are you sure you want to continue?</p>
</bq-dialog>

Sizes

html
<bq-dialog title="Small Dialog" size="sm">
  <p>Compact dialog for simple messages.</p>
</bq-dialog>

<bq-dialog title="Medium Dialog" size="md">
  <p>Default size, suitable for most use cases.</p>
</bq-dialog>

<bq-dialog title="Large Dialog" size="lg">
  <p>Large dialog for complex content.</p>
</bq-dialog>

<bq-dialog title="Extra Large Dialog" size="xl">
  <p>Extra-large dialog for data-heavy views.</p>
</bq-dialog>

<bq-dialog title="Full Screen" size="full">
  <p>Full-screen dialog for immersive experiences.</p>
</bq-dialog>

Non-Dismissible

html
<bq-dialog title="Required Action" dismissible="false">
  <p>You must complete this action before continuing.</p>
  <div slot="footer">
    <bq-button>Acknowledge</bq-button>
  </div>
</bq-dialog>
html
<bq-dialog title="Save Changes?">
  <p>You have unsaved changes. Do you want to save before leaving?</p>
  <div slot="footer">
    <bq-button variant="ghost">Discard</bq-button>
    <bq-button variant="primary">Save</bq-button>
  </div>
</bq-dialog>

Properties

PropertyTypeDefaultDescription
openbooleanfalseControls visibility of the dialog
titlestringDialog heading text
sizesm | md | lg | xl | fullmdWidth preset for the dialog
dismissiblebooleantrueAllows closing via overlay click, Escape key, and close button

Events

EventDetailDescription
bq-closeFired when the dialog is dismissed

Slots

SlotDescription
(default)Dialog body content
footerFooter area, typically used for action buttons

CSS Parts

PartDescription
overlayBackground overlay behind the dialog
dialogThe dialog container
headerHeader section containing the title and close button
titleTitle text element
closeClose / dismiss button
bodyBody content area
footerFooter section

Accessibility

  • Uses role="dialog" and aria-modal="true" for proper screen reader semantics.
  • Title is linked via aria-labelledby so the dialog is announced by name.
  • Focus is trapped within the dialog while open and restored to the trigger on close.
  • Press Escape to dismiss the dialog.

Released under the MIT License.