Components
Toast
Provider-based toast notification system. Trigger toasts from anywhere with imperative API.
import{ Toast }from"oks-ui"
6 positionsAuto-dismissPromise support7 variantsCustom duration
Basic
Wrap your app in ToastProvider, then call toast() anywhere.
Toast requires ToastProvider. Use toast() or showToast() to trigger.
Interactive Playground
Controls
Preview
Generated Code
<ToastProvider>
<App />
</ToastProvider>
// Trigger from anywhere:
toast.success("Saved successfully!");
toast.error("Something went wrong.");Props
| Prop | Type | Default | Description |
|---|---|---|---|
| position | "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right" | "top-right" | Toast stack position. |
| maxToasts | number | 5 | Maximum visible toasts. |
| defaultDuration | number | 4000 | Default toast display duration (ms). |
| disableAnimation | boolean | false | Disable toast animations. |
| toastOffset | number | 12 | Offset between stacked toasts. |
position"top-right"
"top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right"
Toast stack position.
maxToasts5
number
Maximum visible toasts.
defaultDuration4000
number
Default toast display duration (ms).
disableAnimationfalse
boolean
Disable toast animations.
toastOffset12
number
Offset between stacked toasts.