Orasund/elm-ui-widgets/1.0.0

NOTE: the latest version is 3.4.0

Widget.Snackbar

A snackbar shows notification, one at a time.

Basics

type alias Model a =
{ queue : Queue ( a, Int )
, current : Maybe ( a, Int )
}

A snackbar has a queue of Notifications, each with the amount of ms the message should be displayed

init : Model a

Inital state

current : Model a -> Maybe a

Returns the current element.

timePassed : Int -> Model a -> Model a

Updates the model. This functions should be called regularly. The first argument is the milli seconds that passed since the last time the function was called.

Operations

insert : a -> Model a -> Model a

Insert a message that will last for 10 seconds.

insertFor : Int -> a -> Model a -> Model a

Insert a message for a specific amount of milli seconds.

dismiss : Model a -> Model a

Dismiss the current message.