Last modified: 4/Oct/2024
Toaster
Toasters provide brief feedback about an operation through a message at the bottom of the screen.
#Usage
import { useState } from 'react'
import { Toaster } from '@kinsta/stratus'
const MyComponent = () => {
const [isVisible, setIsVisible] = useState(false)
return (
<>
<button onClick={() => setIsVisible(true)}>
Open Toaster
</button>
<Toaster
type="success"
title="You managed to open this. You are a marvel."
isOpen={isVisible}
onCancel={() => setIsVisible(false)}
/>
</>
)
}
#Props
#onCancel
() => void
Title for the toaster
#text
ReactNode
Text for the toaster
Type of toaster
#isMultiple
boolean
If we want to show more than one toaster
#isOpen
boolean
To know if the toaster is open
string
#Types
ToasterProps
: props of theToaster
component processed by stratusNotificationType
: strings that identify the type of notification ("success" ǀ "info" ǀ "warning" ǀ "error"
)
Read more about types here