GitHub

Reference machines

toast

interface 3 type 5 function 1
interface Interfaces 3

# CreateToastInput

Members

defaultDuration?
optional defaultDuration?: number

Default 5000ms.

initial?
optional initial?: ToastItem[]

Initial toasts — useful for SSR hydration.

max?
optional max?: number

Default 5; oldest dropped when full. Use Infinity to disable trim.

# ToastContext

Members

defaultDuration
defaultDuration: number

Default duration applied to ADDs that omit it.

max
max: number

Hard limit; older toasts dropped from the front when exceeded.

toasts
toasts: readonly ToastItem[]

# ToastItem

Members

description?
optional description?: string
duration?
optional duration?: number

Auto-dismiss delay in ms. -1 (or Infinity) = sticky. Default 5000.

id
id: string

Stable identifier — caller-supplied or generated by Layer 3.

meta?
optional meta?: Record<string, unknown>

Free-form metadata — passed back to the consumer's render.

politeness?
optional politeness?: ToastPoliteness
title
title: string
type?
optional type?: ToastType
type Type Aliases 5

# ToastEvent

ToastEvent = { toast: ToastItem; type: "ADD"; } | { id: string; type: "REMOVE"; } | { id: string; patch: Partial<Omit<ToastItem, "id">>; type: "UPDATE"; } | { type: "CLEAR"; } | { type: "SET.MAX"; value: number; }

# ToastPoliteness

ToastPoliteness = "polite" | "assertive"

ARIA-live politeness; mapped to aria-live on the toast wrapper.

function Functions 1

# createToastMachine ( )

createToastMachine(input?): ToastMachine

Construct a fresh Toast (toaster) machine.

Parameters

input?
CreateToastInput = {}

Returns

ToastMachine