Dialog
Dialog is a floating surface used to display transient content such as confirmation actions, selection options, and more.
On this page
Description
A Dialog is used to remove the user from the main application flow,
to confirm actions, ask for disambiguation or to present small forms.
Accessibility
- Dialog Accessible Name: A dialog should have an accessible name,
so screen readers are aware of the purpose of the dialog when it opens.
Give an accessible name setting
:title. The accessible name will be used as the main heading inside the dialog. - Dialog unique id: A dialog should be unique. Give a unique id
setting
:dialog_id. If no:dialog_idis given, a default randomize hex id is generated.
The combination of both :title and :dialog_id establishes an
aria-labelledby relationship between the title and the unique id of
the dialog.
Arguments
| Name | Default | Description |
|---|---|---|
id |
| StringThe id of the dialog. |
title | N/A | StringDescribes the content of the dialog. |
subtitle |
| StringProvides additional context for the dialog, also setting the |
size |
| SymbolThe size of the dialog. One of |
position |
| SymbolThe position of the dialog. One of |
position_narrow |
| SymbolThe position of the dialog when narrow. One of |
visually_hide_title |
| BooleanIf true will hide the heading title, while still making it available to Screen Readers. |
system_arguments | N/A | Hash |
Examples
Slots
show_button
Optional button to open the dialog.
| Name | Default | Description |
|---|---|---|
system_arguments | N/A | HashThe same arguments as Button. |
header
Header content.
| Name | Default | Description |
|---|---|---|
show_divider | N/A | BooleanShow a divider between the header and body. |
visually_hide_title | N/A | BooleanVisually hide the |
system_arguments | N/A | HashThe arguments accepted by Dialog::Header. |
body
Required body content.
| Name | Default | Description |
|---|---|---|
system_arguments | N/A | Hash |
footer
Footer content.
| Name | Default | Description |
|---|---|---|
show_divider | N/A | BooleanShow a divider between the footer and body. |
system_arguments | N/A | Hash |
Methods
id
The dialog's ID value.
Dialog::Header
A Dialog::Header is a compositional component, used to render the
Header of a dialog. See Dialog.
Arguments
| Name | Default | Description |
|---|---|---|
id | N/A | StringThe HTML element's ID value. |
title | N/A | StringDescribes the content of the dialog. |
subtitle |
| StringProvides additional context for the dialog, also setting the |
show_divider |
| BooleanShow a divider between the header and body. |
visually_hide_title |
| BooleanVisually hide the |
variant |
| SymbolOne of |
system_arguments | N/A | Hash |
Dialog::Footer
A Dialog::Footer is a compositional component, used to render the
Footer of a dialog. See Dialog.
Arguments
| Name | Default | Description |
|---|---|---|
show_divider |
| BooleanShow a divider between the footer and body. |
system_arguments | N/A | Hash |
Dialog::Body
A Dialog::Body is a compositional component, used to render the
Body of a dialog. See Dialog.
Arguments
| Name | Default | Description |
|---|---|---|
system_arguments | N/A | Hash |