orus-io/elm-orus-ui/1.0.1

Formerly cdevienne/elm-orus-ui. Search finds this package by either name.

OUI.Element.Modal

Utilities for Elm-UI

Modals

This modal API is taken from Orasund/elm-ui-widgets

single : List (Modal msg) -> List (Attribute msg)

A modal showing a single element.

Material design only allows one element at a time to be viewed as a modal. To make things easier, this widget only views the first element of the list. This way you can see the list as a queue of modals.

import Element


type Msg
    = Close


Element.layout
    (singleModal
        [ { onDismiss = Just Close
          , content =
              Element.text "Click outside this window to close it."
          }
        ]
    )
    |> always "Ignore this line" --> "Ignore this line"

Technical Remark:

  • To stop the screen from scrolling, set the height of the layout to the height of the screen.
multi : List (Modal msg) -> List (Attribute msg)

Same implementation as singleModal but also displays the "queued" modals.

import Element


type Msg
    = Close


Element.layout
    (multiModal
        [ { onDismiss = Just Close
          , content =
              Element.text "Click outside this window to close it."
          }
        ]
    )
    |> always "Ignore this line" --> "Ignore this line"
map : (a -> b) -> Modal a -> Modal b

map a Modal