useToast
Toast trigger, paired with a single root-mounted LxToastHost (component usage and live demo on the Toast component page).
Usage
ts
import { useToast } from '@luxeanor/ui'
const toast = useToast()
toast.success('Saved')
toast.error('Network error')
toast.show('warning', 'Quota almost used up', 6000) // custom durationAPI
| Method | Signature | Description |
|---|---|---|
| show | (type: ToastType, message: string, duration = 3000) => void | generic trigger |
| success / error / info / warning | (message: string) => void | semantic shortcuts (3s) |
ToastType = 'success' | 'error' | 'info' | 'warning'
Behavior & boundaries:
- State is a module-level
refrendered byLxToastHost— nothing shows if the host isn't mounted - Auto-dismisses; no manual close API
- No-op under SSR: the server process is shared across requests, so writing module state would leak to other users;
LxToastHostalso renders nothing in SSR output (mounted guard)