Snackbar
Displays an important message globally. The component is also known as a toast.
Snackbars inform users of a process that an app has performed or will perform. They appear temporarily, towards the bottom of the screen.
They shouldn’t interrupt the user experience.
Only one snackbar may be displayed at a time.
Simple Snackbars
This is a snackbar!
Placement
You can use placement
property to change the snackbar's horizontal placement.
The informative text!
Color
You can use color
property to change the snackbar's color.
The informative text!
API
Learn more about the properties and the customization points.
Usage
import Snackbar from "@sonnat/ui/Snackbar";//orimport { Snackbar } from "@sonnat/ui";
Properties
Note that the documentation avoids mentioning all the native props (there are a lot) in this section of the components.
Name | Type | Default | Description |
---|---|---|---|
text required | string | - | The text to display. |
className | string | - | Append to the class names applied to the component so you can override or extend the styles. |
actionLabel | string | - | The text to display on the action button. |
icon | node | - | The leading icon element placed before the text. |
placement | "left" | "center" | "right" | "center" | The horizontal placement of the snackbar. |
autoHide | boolean | number | false | If true , the snackbar automatically closes after a calculated time.This calculated time depends on the number of characters in the snackbar's content. If a number is entered, the snackbar will be closed after that amount of time (in miliseconds). |
open | boolean | false | If true , the snackbar will be open. |
closable | boolean | false | If true , the snackbar will have close button. |
color | "default" | "success" | "warning" | "error" | "info" | "default" | The color of the snackbar. |
onClose | function | - | The callback fires when the component has closed. Signature: function() => void |
actionCallback | function | - | The Callback fires when the action button is clicked. Signature: function() => void |
|