Modal

Dialog/popup component for focused interactions
Class Reference

There are 3 ways to use a modal:

  1. Using <dialog> element (needs JS) with Esc key supportRecommended
  2. Hidden <input type='checkbox'> with <label> toggleLegacy
  3. <a> anchor links with URL parametersLegacy

Method 1: Using <dialog> Elementrecommended

Basic dialog modal

Opens on click using ID.showModal() method

Dialog with outside click

Click backdrop to close

Dialog with corner close

Custom close button in top-right corner

Custom width dialog

Responsive width controls

Responsive dialog

Mobile-first positioning

Checkbox modal

Uses hidden checkbox state (legacy)

Backdrop Checkbox Modal

With clickable backdrop overlay

Method 2: Hidden Checkboxlegacy

ℹ️ Note: May have z-index issues in complex layouts

Method 3: Anchor Linkslegacy

ℹ️ Note: Limited SPA compatibility - dialog method recommended

Class Reference

Class name Type Description
modal Component Container for modal content
modal-box Part Main content container
modal-action Part Actions part (buttons, etc.)
modal-backdrop Part Clickable overlay background
modal-toggle Part Hidden checkbox for modal state
modal-open Modifier Force open state
modal-top Placement Align to top of screen
modal-middle Placement Vertical centering [Default]
modal-bottom Placement Align to bottom
modal-start Placement Align to start horizontally
modal-end Placement Align to end horizontally
Do you have a question? ask the community
Do you see a bug? open an issue on GitHub