grille_pain/lustre/toast

grille_pain/lustre/toast defines the different effects to use to display toasts with lustre.

Types

Options type allow to modify timeout or level at the notification level directly. This is used to create custom toasts and override defaults. If you don’t need custom toasts, you should head up to default functions (toast, info, success, error and warning).

It follows the Builder pattern.

import grille_pain/toast
import grille_pain/toast/level

fn custom_toast() {
  toast.options()
  |> toast.timeout(millisecond1s: 30_000)
  |> toast.level(level.Warning)
  |> toast.custom("Oops")
}
pub type Options =
  toast.Options

Constants

pub const level: fn(Options, Level) -> Options

Level of your toast.

pub const options: fn() -> Options

Default options, 5s seconds of timeout.

pub const timeout: fn(Options, Int) -> Options

Timeout to override defaults. Accepts a timeout in milliseconds.

Functions

pub fn custom(options: Options, content: String) -> Effect(a)
pub fn error(content: String) -> Effect(a)
pub fn info(content: String) -> Effect(a)
pub fn success(content: String) -> Effect(a)
pub fn toast(content: String) -> Effect(a)
pub fn warning(content: String) -> Effect(a)
Search Document