Snackbar
A Snackbar displays brief messages about app processes and dismisses automatically after a set time.
You can build a Snackbar using:
HvSnackbar
– handles positioning, transitions, auto-hide, and more.HvSnackbarContent
– offers fine-grained control over the content and appearance.
Custom Icon
You can pass a custom icon to the snackbar by using the customIcon
prop.
Actions
Use the action
prop to add an action to the snackbar. The onAction
prop is a callback function that is called when the action is clicked.
Long content
Although not desirable, sometimes you may need to display a long message in the snackbar. You can combine the snackbar with the HvOverflowTooltip
component to display the full message.
Customization
You can customize the Snackbar
by setting its position, transition direction, and auto-hide duration.
- Use
anchorOrigin
to define its position on the screen. - Use
transitionDirection
to control how it appears and disappears. - Use
setAutoHideDuration
(in milliseconds) to specify how long it stays visible. When it closes, theonClose
callback is triggered with the reason set to"timeout"
.