GitHub

Dialog

A modal dialog using the native HTML dialog element with focus trap, ESC to close, and htmx integration.

<rhx-dialog>

Examples

Basic Dialog

Example Dialog

This is a basic dialog with a title and close button.

Press ESC or click the close button to dismiss.

No Header

Are you sure you want to proceed?

With Footer

htmx Integration

Edit Profile

Loading...

Properties

Property Type Default Description
rhx-open bool false Whether the dialog is initially open
rhx-label string - Title text displayed in the dialog header
rhx-no-header bool false Hides the default header with title and close button
id string - Element ID used for dialog open triggers

Accessibility

  • Uses the native <dialog> element with built-in focus trap and inert background.
  • ESC key closes the dialog.
  • Dialog title is linked via aria-labelledby for screen readers.
  • Close button has aria-label="Close".
  • Focus is returned to the trigger element when the dialog closes.