Custom styles
This component uses basic inline styles to style the position and visibility of the notification. I would suggest reading the usage guidelines for snackbars before making any changes.
You have two options for adding additional styles:
Remove all inline styles and use only CSS.
Add additional inline styles via the style prop.
The DOM tree of the component for reference:
To use additional inline styles, return two objects. The bar
object applies styles to the entire notification "snackbar" and the action
object applies styles to the action message. Under the hood, this uses Object.assign
to handle properly combining styles.
I would highly suggest using this method since the styles included in the component by default handle the visibility of the notification. If you remove these styles, the component won't actually show or hide itself.
barStyleFactory and activeBarStyleFactory NotificationStack props
These two function have the following signature:
Where index
is the index of the notification in the notifications array, style
is the style property of the individual notification and notification
is the notification itself.
This function is used to dynamically set the style of each notification in the stack. The default function adds the bottom
style property to correctly position the notification in a stack.
Last updated