mercurymedia/elm-message-toast/1.0.2

NOTE: the latest version is 3.0.0

MessageToast

MessageToast displays a list of feedback messages, each with a specified message-type.

Definition

type MessageToast msg
= MessageToast (ToastConfig msg) (List ToastMessage)

MessageToast holds the collection of messages.

Init

init : (MessageToast msg -> msg) -> MessageToast msg

Initializes the messageToast handler with the default settings.

- Delay: 8 seconds
- Showing messages: 4
- Styling: default
(MessageToast msg -> msg)
-> { delayInMs : Float
, toastsToShow : Int
}
-> MessageToast msg

Initializes a custom messageToast handler with the provided options.

Create

danger : MessageToast msg -> String -> MessageToast msg

Displays a dangerous message.

info : MessageToast msg -> String -> MessageToast msg

Displays an informative message.

success : MessageToast msg -> String -> MessageToast msg

Displays a success message.

warning : MessageToast msg -> String -> MessageToast msg

Displays a warning message.

View

view : MessageToast msg -> Html msg

Displays the configured message toasts.

Subscriptions

subscriptions : MessageToast msg -> Sub msg

Subscription to automatically remove the oldest toast that is still displayed.

Query

getOldestToast : MessageToast msg -> Maybe ToastMessage

Provides the time-wise oldest message toast that is still shown.

Manipulate

overwriteContainerAttributes : List (Attribute msg) -> MessageToast msg -> MessageToast msg

Overwrite existing styles for the message toast container that contains all the several toasts displayed.

For example, this can be used to override the position or width of the toasts.

overwriteIconAttributes : List (Attribute msg) -> MessageToast msg -> MessageToast msg

Overwrite existing styles for the message toast icon that's placed inside the toast container besides the message block.

For example, this can be used to override colors, spacings or sizes of the icon.

overwriteMessageAttributes : List (Attribute msg) -> MessageToast msg -> MessageToast msg

Overwrite existing styles for the message toast message block that's placed inside the toast container besides the icon.

For example, this can be used to override colors, spacings, font attributes or alignments of the toast message.

overwriteToastAttributes : List (Attribute msg) -> MessageToast msg -> MessageToast msg

Override existing styles for the message toast that wraps the icon and message block.

For example, can be used to ovveride border stylings, shadows or spacings between the toasts.

Removes the time-wise oldest toast from the existing collection.