Skip to content

Toast ​

Small, non-intrusive notification messages shown in the corner of the screen. Supports variants, sizes, and automatic timeout-based dismissal.

ts
import { addToast } from '@/components/kuro/toast'

addToast({
  label: 'Saved!',
  message: 'Your changes have been saved.',
  variant: 'success',
  size: 'md',
  timeout: 3000
})

Installation ​

bash
npx kuro-ui add toast
bash
npx github:Bartek-Nowak/Kuro add toast

Setup ​

Import the Toast component and place it once in your root layout or app shell:

vue
<template>
  <Toast />
</template>

<script setup lang="ts">
import { Toast } from '@/components/kuro/toast'
</script>

API ​

addToast(toast: ToastInput) ​

Adds a new toast notification.

Parameters: ​

NameTypeDescription
labelstringRequired title for the toast.
messagestringOptional message body.
variant"default" | "success" | "error" | "warning" | "info"Color style of the toast.
size"sm" | "md" | "lg"Size of the toast. Default is "md".
timeoutnumberOptional auto-dismiss time in milliseconds.

Variants ​

VariantDescription
defaultNeutral gray styling.
successGreen background.
errorRed background.
warningYellow background.
infoBlue background.

Sizes ​

SizeDescription
smSmall padding and text.
mdMedium padding (default).
lgLarger padding and text.

Requires ​

This component requires the following UI components:

  • Button
  • Text

These dependencies will be automatically installed if missing when using the kuro add toast CLI command.