Usage
The Toast component is typically used with theuseToast composable to display temporary notifications.
useToast Composable
TheuseToast composable provides methods to manage toast notifications.
add(toast)
Add a new toast notification. Parameters:toast- Partial toast configuration object
id
update(id, toast)
Update an existing toast by ID. Parameters:id- The toast ID (string or number)toast- Partial toast configuration to update
remove(id)
Remove a toast by ID. Parameters:id- The toast ID (string or number)
clear()
Remove all toasts.toasts
Reactive array of current toast objects.Toast Props
as
- Type:
any - Default:
'li'
title
- Type:
string | VNode | (() => VNode)
description
- Type:
string | VNode | (() => VNode)
icon
- Type:
string(Iconify icon name)
avatar
- Type:
AvatarProps
color
- Type:
string - Default:
'primary'
orientation
- Type:
'vertical' | 'horizontal' - Default:
'vertical'
close
- Type:
boolean | Omit<ButtonProps, LinkPropsKeys> - Default:
true
closeIcon
- Type:
string(Iconify icon name) - Default:
appConfig.ui.icons.close
actions
- Type:
ButtonProps[]
orientation is vertical, or next to the close button when orientation is horizontal.
progress
- Type:
boolean | Pick<ProgressProps, 'color' | 'ui'> - Default:
true
duration
- Type:
number
defaultOpen
- Type:
boolean
open
- Type:
boolean
type
- Type:
'foreground' | 'background'
class
- Type:
any
ui
- Type:
object
root- The root containerwrapper- The content wrappertitle- The title elementdescription- The description elementicon- The icon elementavatar- The avatar elementavatarSize- The avatar sizeactions- The actions containerprogress- The progress barclose- The close button
Events
Inherits all events from Reka UI’sToastRoot.
Slots
leading
- Props:
{ ui: Toast['ui'] }
title
Customize the title content.description
Customize the description content.actions
Customize the actions section.close
- Props:
{ ui: Toast['ui'] }