mercurymedia / elm-message-toast / MessageToast

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

Definition


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

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

initWithConfig : (MessageToast msg -> msg) -> { delayInMs : Basics.Float, toastsToShow : Basics.Int } -> MessageToast msg

Initializes a custom messageToast handler with the provided options.

Initial

danger : MessageToast msg -> IntermediateMessageToast msg

Generates a dangerous message toast.

info : MessageToast msg -> IntermediateMessageToast msg

Generates an informative message toast.

success : MessageToast msg -> IntermediateMessageToast msg

Generates a success message toast.

warning : MessageToast msg -> IntermediateMessageToast msg

Generates a warning message toast.

Intermediate

persistToast : IntermediateMessageToast msg -> IntermediateMessageToast msg

Keeps the toast persisted in the MessageToast container by making it unaffected to the defined toast-timeout. The toast can still be removed by user clicks.

Final

withHtml : Html msg -> IntermediateMessageToast msg -> MessageToast msg

Displays a generated MessageToast content with a given user-defined layout.

withMessage : String -> IntermediateMessageToast msg -> MessageToast msg

Displays a generated MessageToast content with a given message in the default layout.

View

view : MessageToast msg -> Html msg

Displays the configured message toasts.

Subscriptions

subscriptions : MessageToast msg -> Platform.Sub.Sub msg

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

Manipulate

overwriteContainerAttributes : List (Html.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 (Html.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 (Html.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 (Html.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 override border stylings, shadows or spacings between the toasts.