Overview
Toast is a notification toast system. ToastContainer renders toasts in the top-right corner of the screen via a Portal.
- 4 types — success, error, warning, info
- Auto-dismiss — Automatically disappears after 4 seconds
- Animation — Slide in/out from the right
- Accessible —
role="alert", aria-live applied
Basic Usage
Toast Types
| Type | Use Case | ARIA |
|---|
success | Success notification | aria-live="polite" |
error | Error notification | aria-live="assertive" |
warning | Warning notification | aria-live="polite" |
info | Informational notification | aria-live="polite" |
Colors
Each type has its own background, text, border and icon tokens. In light mode the background is tinted; in dark mode every toast sits on the same neutral surface and only the text, border and icon carry the color, because deep tinted backgrounds turn muddy in the dark (yellow becomes olive).
| Type | Background | Text / border / icon | Close button hover |
|---|
error | background.toast.error | text/border/icon.danger.default | background.toast.errorHover |
success | background.toast.success | text/border/icon.success.default | background.toast.successHover |
warning | background.toast.warning | text/border/icon.warning.default | background.toast.warningHover |
info | background.toast.info | text.brand.default, border.brand.tertiary | background.toast.infoHover |
The close button is a 16px Close icon inside a 24×24 hit area. Its hover background is one step deeper than the toast, not gray.
Components
ToastContainer
| Prop | Type | Default | Required | Description |
|---|
toasts | { id: string; type: ToastType; message: ReactNode }[] | - | Yes | Toasts on screen |
onRemove | (id: string) => void | - | Yes | Called after a toast has closed. Remove it from the list here |
className | string | - | No | Extra CSS class |
Position: top-right of screen (space.400 from the top and right edges). Returns null when there are no toasts.
ToastItem
| Prop | Type | Default | Required | Description |
|---|
type | 'error' | 'success' | 'warning' | 'info' | - | No | Kind of notice. Changes the colors and aria-live |
id | string | - | Yes | Toast id. Passed to onClose |
type | 'error' | 'success' | 'warning' | 'info' | - | Yes | Kind of notice |
message | ReactNode | - | Yes | Message |
onClose | (id: string) => void | - | Yes | Called after the exit animation when it closes (close button or 4 seconds) |
Behavior
- Enter: Slide in from right, 200ms ease-out
- Exit: Slide out to right, 150ms ease-in
- Auto-dismiss: Automatically exits after 4000ms (4 seconds)
- Manual close: Immediately exits on X button click
Specification
base
| 상태 | 요소 | 속성 | 값 |
|---|
| enabled | root | padding | $size.space.300 |
| enabled | root | gap | $size.space.200 |
| enabled | root | borderRadius | $size.radius.200 |
| enabled | root | borderWidth | $size.stroke.border |
| enabled | message | typography | $text.bodySmall |
| enabled | close | padding | $size.space.100 |
| enabled | close | borderRadius | $size.radius.100 |
type=error
| 상태 | 요소 | 속성 | 값 |
|---|
| enabled | root | backgroundColor | $color.background.toast.error |
| enabled | root | borderColor | $color.border.danger.default |
| enabled | message | color | $color.text.danger.default |
| enabled | close | color | $color.icon.danger.default |
| hover | close | backgroundColor | $color.background.toast.errorHover |
type=success
| 상태 | 요소 | 속성 | 값 |
|---|
| enabled | root | backgroundColor | $color.background.toast.success |
| enabled | root | borderColor | $color.border.success.default |
| enabled | message | color | $color.text.success.default |
| enabled | close | color | $color.icon.success.default |
| hover | close | backgroundColor | $color.background.toast.successHover |
type=warning
| 상태 | 요소 | 속성 | 값 |
|---|
| enabled | root | backgroundColor | $color.background.toast.warning |
| enabled | root | borderColor | $color.border.warning.default |
| enabled | message | color | $color.text.warning.default |
| enabled | close | color | $color.icon.warning.default |
| hover | close | backgroundColor | $color.background.toast.warningHover |
type=info
| 상태 | 요소 | 속성 | 값 |
|---|
| enabled | root | backgroundColor | $color.background.toast.info |
| enabled | root | borderColor | $color.border.brand.tertiary |
| enabled | message | color | $color.text.brand.default |
| enabled | close | color | $color.icon.brand.default |
| hover | close | backgroundColor | $color.background.toast.infoHover |
Guidelines
- Place ToastContainer at the app root only once
- Only error type uses
aria-live="assertive" — screen readers announce it immediately
- Use for short, clear notifications rather than long messages