Dialog

A window overlaid on either the primary window or another dialog window, rendering the content underneath inert.

Anatomy

Dialog do |d|
d.trigger
d.content do
d.header do
d.title
d.description
end
d.footer do
d.close
end
end
end

API Reference

Dialog

NameTypeDefault
open:booleanfalse
Controls whether the dialog is initially visible when rendered. When true, the dialog will be open on page load.
attributeskeyword arguments

Dialog#trigger

NameTypeDefault
as_child:booleanfalse
When true, merges the trigger functionality with the child element instead of wrapping it in a div. Useful for styling custom trigger elements.
attributeskeyword arguments

Dialog#content

NameType
attributeskeyword arguments

Dialog#header

NameType
attributeskeyword arguments

Dialog#title

NameType
attributeskeyword arguments

Dialog#description

NameType
attributeskeyword arguments
NameType
attributeskeyword arguments

Dialog#close

NameTypeDefault
as_child:booleanfalse
When true, merges the close functionality with the child element instead of rendering a default button. Useful for custom styled close buttons.
attributeskeyword arguments

Keyboard Interactions

KeyDescription
SpaceOpens/closes the dialog.
EnterOpens/closes the dialog.
TabMoves focus to the next focusable element.
Shift+TabMoves focus to the previous focusable element.
EscCloses the dialog and moves focus to trigger.

Examples