PaackEng / paack-ui / UI.Dialog

The UI.Dialog is a component for displaying dialogs and modals.

User must specify a title and an icon to be displayed in the title to construct it. Body and buttons can be specified optionally as in the following pipeline:

dialog "Title" Icon.warning closeMsg
    |> withBody ("Body text" |> Text.body2 |> Text.renderElement cfg)
    |> withButtons buttons

Building


type Dialog msg
    = Dialog Properties (Options msg)

The Dialog msg type is used for describing the component for later rendering.

dialog : String -> UI.Icon.Icon -> Dialog msg

Constructs a dialog by receiving its title and an icon in the title.

Content

withBody : Element msg -> Dialog msg -> Dialog msg

With Dialog.withBody you can specify the body of the dialog.

Note: By default, the body is Element.none

withButtons : List (UI.Button.Button msg) -> Dialog msg -> Dialog msg

With Dialog.withButtons you can specify the buttons for the footer of the dialog.

Note: By default, the buttons are an empty list

Component handling

map : (a -> b) -> Dialog a -> Dialog b

Transforms the message produced by the component.