Props
Customize the behavior of SolidNotifications with these configurable props.
Toaster config
Global props. Can be applied to ToastProvider and Toaster.
-
limit - The maximum number of toasts to display at once. Excess toasts are queued and rendered when space becomes available. For no limit, set limit to
falseor0.Default value:
8 -
reverseToastOrder - If true, toasts are rendered in reverse order (newest at the top/bottom).
Default value:
false -
offsetX - Horizontal offset for the toaster's position.
Default value:
16 -
offsetY - Vertical offset for the toaster's position.
Default value:
16 -
gutter - Spacing between toasts.
Default value:
16 -
positionY - Vertical positioning of the toaster.
Default value:
"top" -
positionX - Horizontal positioning of the toaster.
Default value:
"right" -
renderOnWindowInactive - If true, toasts will render even when the window is inactive (blurred).
Default value:
false -
pauseOnWindowInactive - If true, toast progress will pause when the window is inactive (blurred).
Default value:
true -
toasterStyle - Custom styles for the toaster container.
Default value:
null
Toast config
Toast props. Can be applied to all components; ToastProvider, Toaster and Toast.
-
theme - The theme of the toast. Two theme types are included;
lightanddark, but any string can be provided.Default value:
"light" -
type - The type of the toast. Can be "default", "success", "error", "info", "warning" and "loading".
Default value:
"default" -
duration - Duration (in milliseconds) before the toast is dismissed. Set to
falseor0for persistent toasts.Default value:
5000 -
onEnter - CSS animation name when the toast enters.
Default value:
undefined -
enterDuration - Duration of the enter animation in milliseconds. Should be set to the same duration as the animation.
Default value:
300 -
onExit - CSS animation name when the toast exits.
Default value:
undefined -
exitDuration - Duration of the exit animation in milliseconds. Should be set to the same duration as the animation.
Default value:
300 -
onIdle - CSS class which will be applied when the toast is idle.
Default value:
undefined -
class - CSS class applied to the toast body. Can be a string or a function returning a string. The function will be provided with
themeandtypeas arguments.Default value:
"sn-toast" -
style - Custom styles for the toast body. Can be an object containing css properties or a function returning the object. The function will be provided with
themeandtypeas arguments.Default value:
undefined -
pauseOnHover - Whether the toast pauses when hovered. If the toast or element inside the toast has focus, the timer will not play when mouse leaves the toast.
Default value:
true -
wrapperClass - CSS class for the toast wrapper. Can be a string or a function returning a string. The function will be provided with
themeandtypeas arguments.Default value:
"sn-toast-wrapper" -
wrapperStyle - Custom styles for the toast wrapper. Can be an object containing css properties or a function returning the object. The function will be provided with
themeandtypeas arguments.Default value:
undefined -
enterCallback - Callback function executed when the toast enters.
Default value:
null -
updateCallback - Callback function executed when the toast updates.
Default value:
null -
exitCallback - Callback function executed when the toast exits. It will provide a
reasonargument with which thedismiss()function was called, or if it wasn't provided, the reason will befalseif the toast dismissed by timer expiration, ortrueif it was dismissed by the user.Default value:
null -
showDismissButton - Whether to show a dismiss button.
Default value:
true -
dismissButtonClass - CSS class for the dismiss button. Can be a string or a function returning a string. The function will be provided with
themeandtypeas arguments.Default value:
"sn-dismiss-button" -
dismissButtonStyle - Custom styles for the dismiss button. Can be an object containing css properties or a function returning the object. The function will be provided with
themeandtypeas arguments.Default value:
undefined -
dismissOnClick - Whether clicking the toast dismisses it.
Default value:
false -
showProgressBar - Whether to show a progress bar on the toast.
Default value:
true -
progressBarClass - CSS class for the progress bar. Can be a string or a function returning a string. The function will be provided with
themeandtypeas arguments.Default value:
"sn-progress-bar" -
progressBarStyle - Custom styles for the progress bar. Can be an object containing css properties or a function returning the object. The function will be provided with
themeandtypeas arguments.Default value:
undefined -
showIcon - Whether to show an icon in the toast.
Default value:
true -
icon - Custom icon for the toast. Can be a JSX element or a function returning a JSX element. The function will be provided with
themeandtypeas arguments.Default value:
null -
dragToDismiss - Whether dragging the toast dismisses it.
Default value:
true -
dragTreshold - Distance (in pixels) required to dismiss the toast via dragging.
Default value:
100 -
ariaLive - ARIA live attribute for accessibility.
Default value:
"polite" -
role - ARIA role attribute.
Default value:
"status"
Other config
Props that are used depending on where they are applied.
-
id - Unique identifier for the toast. If not provided, an ID is generated automatically.
-
content - The main content of the toast. Can be a string, JSX element, or a function returning JSX. If function, receives
Toastas argument. -
toasterId - Specifies the toaster instance where the toast should be displayed. Required when using multiple toasters.