mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-26 11:44:28 +08:00
feat(sonner): add dismiss method to toast API
Add the ability to dismiss specific toast notifications by their ID. This provides more control over toast management in the UI.
This commit is contained in:
parent
8794f2b3ac
commit
c8c67006af
@ -140,6 +140,15 @@ interface toast {
|
||||
* })
|
||||
*/
|
||||
loading: (props: QuickLoadingProps) => void
|
||||
|
||||
/**
|
||||
* Dismiss a toast notification by its ID
|
||||
* @param id - The ID of the toast to dismiss
|
||||
* @example
|
||||
* const toastId = toast.info({ title: 'Info' })
|
||||
* toast.dismiss(toastId)
|
||||
*/
|
||||
dismiss: (id: string | number) => void
|
||||
}
|
||||
|
||||
// Export types for external use
|
||||
|
||||
@ -345,6 +345,10 @@ toast.loading = (props: QuickLoadingProps) => {
|
||||
})
|
||||
}
|
||||
|
||||
toast.dismiss = (id: ToastProps['id']) => {
|
||||
sonnerToast.dismiss(id)
|
||||
}
|
||||
|
||||
const toastColorVariants = cva(undefined, {
|
||||
variants: {
|
||||
type: {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user