sanity
Version:
Sanity is a real-time content infrastructure with a scalable, hosted backend featuring a Graph Oriented Query Language (GROQ), asset pipelines and fast edge caches
24 lines (18 loc) • 532 B
text/typescript
import {useToast} from '@sanity/ui'
import {forwardRef, type ReactNode, useImperativeHandle} from 'react'
/** @internal */
export interface ToastParams {
closable?: boolean
description?: ReactNode
duration?: number
onClose?: () => void
title?: ReactNode
status?: 'error' | 'warning' | 'success' | 'info'
}
/** @internal */
export const ImperativeToast = forwardRef((_, ref) => {
const {push} = useToast()
useImperativeHandle(ref, () => ({push}))
return null
})
ImperativeToast.displayName = 'ImperativeToast'