A notice for a job that takes a while: it fills as the job advances (progress, 0 to 100), with a ring of
light while it runs. When the LiveView sets state to :done it waits a moment (1.6 s, paused while the
pointer or the focus is on it), leaves, and tells the LiveView (on_dismiss, with phx-value-id) to drop
it. An :error never leaves by itself: the person reads it and closes it.
The LiveView is the source of truth: it holds the job's progress (from an Oban job's PubSub, say) and
renders this with the current state and progress.
Summary
Functions
Attributes
id(:string) (required)state(:atom) - Defaults to:running. Must be one of:running,:done, or:error.progress(:integer) - 0 to 100. Defaults to0.title(:string) (required)on_dismiss(:string) (required) - event sent withphx-value-idwhen it leaves.dismiss_label(:string) (required) - for the × button.target(:any) - the@myselfof a LiveComponent that holds the toast. Defaults tonil.class(:any) - Defaults tonil.- Global attributes are accepted.
Slots
icon- drawn before the title.close_icon- replaces the typographic × of the dismiss button.inner_block- a line under the title: the step, or what went wrong.