structyl

Snackbar

stable

A brief status message.

Basic usage

Saved successfully

Examples

Static placement

Override positioning for embedded examples and tests.

Profile updated

Auto-hide message

Use autoHideDuration when the snackbar should dismiss itself.

Saved for later

Anchors and actions

Snackbar supports MUI-style anchorOrigin, message, action, auto-hide and close reasons.

Archived

Features

  • Controlled or uncontrolled.
  • Optional auto-hide duration.

Installation

bash
pnpm dlx structyl add snackbar

API Reference

Snackbar

Floating status message.

PropTypeDefault
open | defaultOpenboolean

Controlled or uncontrolled open state.

onOpenChange(open: boolean) => void

Open state callback.

anchorOrigin{ vertical: 'top' | 'bottom'; horizontal: 'left' | 'center' | 'right' }

Screen placement.

{ vertical: 'bottom', horizontal: 'left' }
message | actionReact.ReactNode

Message and action slots.

autoHideDurationnumber

Auto-dismiss delay.

onClose(event, reason: 'timeout' | 'clickaway' | 'escapeKeyDown') => void

Close request callback.

classNamestring

Additional Tailwind classes merged with the component defaults.

Snackbar | structyl