Skip to content
bahtuiv0.6.0

<baht-modal>

Controlled dialog: you flip open, it asks to close via baht-close.

Open / close

Open modal

This cannot be undone.

<baht-button id="open-btn">Open modal</baht-button>
<baht-modal id="my-modal" heading="Delete workflow?" description="Steps and run history will be removed.">
  <p>This cannot be undone.</p>
  <div class="baht-modal-footer">
    <baht-button variant="secondary" id="cancel-btn">Cancel</baht-button>
    <baht-button variant="danger">Delete</baht-button>
  </div>
</baht-modal>

<script>
  const modal = document.getElementById('my-modal');
  document.getElementById('open-btn').addEventListener('click', () => (modal.open = true));
  document.getElementById('cancel-btn').addEventListener('click', () => (modal.open = false));
  modal.addEventListener('baht-close', () => (modal.open = false));
</script>
NameTypeDefaultDescription
openbooleanfalseHost controls visibility
headingstring''Dialog title
descriptionstring''Muted line under the title; wired to aria-describedby
show-closebooleantrueShow × button
close-on-scrimbooleantrueScrim click requests close
EventdetailDescription
nameCustomEvent
baht-close{ reason: 'escape'|'scrim'|'button' }User wants it closed. Host sets open=false
SlotDescription
(default)Dialog body