Snackbar
stableA brief status message.
Basic usage
Examples
Static placement
Override positioning for embedded examples and tests.
Auto-hide message
Use autoHideDuration when the snackbar should dismiss itself.
Anchors and actions
Snackbar supports MUI-style anchorOrigin, message, action, auto-hide and close reasons.
Features
- Controlled or uncontrolled.
- Optional auto-hide duration.
Installation
bash
pnpm dlx structyl add snackbarAPI Reference
Snackbar
Floating status message.
| Prop | Type | Default |
|---|---|---|
| open | defaultOpen | booleanControlled or uncontrolled open state. | — |
| onOpenChange | (open: boolean) => voidOpen state callback. | — |
| anchorOrigin | { vertical: 'top' | 'bottom'; horizontal: 'left' | 'center' | 'right' }Screen placement. | { vertical: 'bottom', horizontal: 'left' } |
| message | action | React.ReactNodeMessage and action slots. | — |
| autoHideDuration | numberAuto-dismiss delay. | — |
| onClose | (event, reason: 'timeout' | 'clickaway' | 'escapeKeyDown') => voidClose request callback. | — |
| className | stringAdditional Tailwind classes merged with the component defaults. | — |