Skip to content

Toast

A succinct message that is displayed temporarily.

Installation

npm i @huin-core/react-toast

API Reference

Toaster

PropTypeDefaultDescription
position"top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right"bottom-rightWhere the toast stack is anchored in the viewport.
richColorsbooleanApplies type-specific accent colors (success, error, warning, info) instead of the neutral default.
closeButtonbooleanShows a dedicated close button on every toast.
expandbooleanKeeps the full stack expanded instead of collapsing extra toasts behind the front one.
durationnumberTime in milliseconds a toast stays visible before closing itself. Applies to every toast under the provider unless one overrides it.
hotkeystringThe key combination that moves focus to the toast viewport, given as an array of event.code values.
gapnumberSpacing in pixels between stacked toasts.
visibleToastsnumberMaximum number of toasts shown at once before older ones collapse behind the stack.

Keyboard Interactions

KeyDescription
F8
Moves focus to the toast viewport.
Tab
Moves focus through the toast's own controls.
Esc
Dismisses the focused toast.