um

Toast

Flashes and stream responses as toasts that dismiss themselves, pause while hovered or focused, and survive Drive visits and morph refreshes.

JavaScript API

Show, update and dismiss notifications without a server request. Try an async action, a rejected action, or a scoped panel.

Show a notification, then update or dismiss it.

Rails and JavaScript together

The response gives the toast a logical id. JavaScript can dismiss it using that id.

From a flash, after a redirect

Each button sets flash[type] and redirects back. Hover a toast to hold it open.

From a stream response

turbo_stream.toast pops one without a redirect.

Title, icon and action

A heading adds context; actions are ordinary Rails buttons or links.

Image and actions

A toast can contain a title, description, image, and buttons.

Upload in progress

A progress component inside a toast appears in the top-right stack.

Tones

Good, warn, bad and info, plus neutral, accent and inverted surfaces.

Six positions

Place each toast independently. Start and end follow the reading direction.

Duration and sticky toasts

Mix timed and sticky messages. A duration of 0 waits for the dismiss button.

Widths

Short, long or a pixel width; each stays within the screen on a phone.

Action layouts

Give horizontal actions room with width: :long, or place them below with layout: :vertical. Narrow toasts stack automatically. close_button: false hides the × when a Dismiss action is provided.

Custom leading content

Use the leading slot for an avatar or other context instead of the default icon.

Custom content

Capture a body slot for a composed announcement. The close button stays available.

Inside a panel

A named, scoped mount contains notifications within a positioned panel.

Above an open dialog

A toast streamed from a dialog shows above it, and times out even though the dialog makes it inert.

A dialog

A toast streamed from in here shows above the dialog, not under its backdrop. It can't be hovered or dismissed until the dialog closes, but it still times out on its own.