Dialogs inform users about a task and can contain critical information, require decisions, or involve multiple tasks.
import Material.Button as Button
import Material.Dialog as Dialog
type Msg
= Closed
main =
Dialog.alert
(Dialog.config
|> Dialog.setOpen True
|> Dialog.setOnClose Closed
)
{ content = [ text "Discard draft?" ]
, actions =
[ Button.text
(Button.config |> Button.setOnClick Closed)
"Cancel"
, Button.text
(Button.config
|> Button.setOnClick Closed
|> Button.setAttributes [ Dialog.defaultAction ]
)
"Discard"
]
}Specify a message when the user closes the dialog
Specify whether click the dialog's scrim should close the dialog
If set to True, clicking on the dialog's scrim results in the dialog's
setOnClose mege. Defaults to True.
Specify additional attributes
Alert dialog view function
Simple dialog view function
Confirmation dialog view function
Fullscreen view function
A button that is marked with this attribute is automatically activated by
the containing dialog on pressing the Enter key.
An element that is marked with this attribute is automatically focus on opening the containing dialog.
Configuration of a dialog