Toast
A succinct message that is displayed temporarily.
Examples
import { useToast, Button } from 'kalki-design'
export function Example() {
const { addToast } = useToast()
return (
<Button
onClick={() =>
addToast('Your changes were saved successfully.', {
type: 'info',
title: 'Profile Updated',
duration: 5000,
position: 'bottom-right',
})
}
>
Show Toast
</Button>
)
}Installation
npx kalki-design add toastUsage
import { Toast } from 'kalki-design'
export default function Example() {
return <Toast />
}API Reference
| Name | Type | Default | Description |
|---|---|---|---|
Nametype | Type'info' | 'success' | 'warning' | 'error' | Default'info' | DescriptionVisual intent of the toast. |
Nametitle | Typestring | Default— | DescriptionPrimary title. |
Namemessage | Typestring | Default— | DescriptionSub-message or description. |
Nameduration | Typenumber | Default5000 | DescriptionMilliseconds before auto-dismissal. 0 to disable. |
Nameposition | Type'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | 'top-center' | 'bottom-center' | Default'bottom-right' | DescriptionScreen position where the toast appears. |
NameonClose | Typefunction | Default— | DescriptionCallback fired when dismissed. |