Skip to content

Toast ​

Temporary notifications inspired by noice.nvim, with configurable positioning and deduplication.

Toast

Design lines ​

✓Deployed ok
vue
1<Tabs defaultValue="tuix">2  <TabsList>3    <Tab value="tuix">TUIX</Tab>4    <Tab value="rubik">Rubik</Tab>5  </TabsList>6  <TabPanel value="tuix">7    <Toast message="Deployed ok" color="success" design="tuix" />8  </TabPanel>9  <TabPanel value="rubik">10    <Toast message="Deployed ok" color="success" design="rubik" />11  </TabPanel>12</Tabs>

Demo ​

Basic (message / color) ​

Renders toasts with a message and a semantic color at each position.

vue
1<script setup lang="ts">2import { ref } from 'vue'3import { ToastContainer } from '@dowardev/herdrate-vue'4const items = ref([])56function showAt(position: string) {7  items.value.push({ id: Date.now(), message: 'Hello', color: 'primary', position })8}9function dismiss(id: number) {10  items.value = items.value.filter(t => t.id !== id)11}12</script>1314<template>15  <button @click="showAt('bottom-right')">bottom-right</button>16  <ToastContainer17    :toasts="items.filter(t => t.position === 'bottom-right')"18    :remove="dismiss"19    position="bottom-right"20  />21</template>

Demo with useToast() ​

This demo uses the real useToast() composable from the package (singleton, shared state) — aligned with the flow you would copy to your project.

API ​

Toast ​

Props accepted by the Toast component.

PropTypeDefaultDescription
messagestring—Toast content
color'primary' | 'secondary' | 'tertiary' | 'success' | 'warning' | 'danger' | 'light' | 'medium' | 'dark''primary'Semantic toast color
iconstring''Custom icon (default: ▼/✓/●/✖)
design'tuix' | 'rubik'— (inherits from data-design)Design line (or inherit from data-design).

Events ​

EventPayloadDescription
closevoidEmitted when the close button is clicked.

ToastContainer ​

Container that renders a toast list at a fixed screen position.

PropTypeDefaultDescription
toastsArray<{id, message, color, icon, timestamp}>—List of toasts to display
remove(id: string) => void—Function to close a toast
position'bottom-right' \| 'bottom-left' \| 'top-right' \| 'top-left' \| 'top-center' \| 'bottom-center''bottom-right'Screen position

useToast() ​

Composable that returns the toast list and its helpers.

ReturnTypeDescription
toastsRef<Array<{id, message, color, icon, timestamp}>>Reactive list of active toasts
add(opts: {message, color?, replace?, filter?}) => stringAdds a toast, returns ID
remove(id: string) => voidRemoves a toast by ID

toasts — each toast has this shape:

FieldTypeRequiredDescription
idstring✅Unique identifier
messagestring✅Message to display
colorColor✅Semantic color
iconstring✅Icon or emoji
timestampnumber✅UNIX timestamp

add(opts) — options accepted when creating a toast:

PropTypeDefaultDescription
messagestring—Toast content
color'primary' | 'secondary' | 'tertiary' | 'success' | 'warning' | 'danger' | 'light' | 'medium' | 'dark''primary'Semantic color
replacebooleanfalseReplaces duplicate toast
filterstring—Key to detect duplicates

CSS Custom Properties ​

TokenDefaultDescription
--font-mono"JetBrains Mono", ui-monospace, monospaceMonospace font stack for code-like content (key labels, log lines, chips).
--accentfrom theme (--ctp-latte-mauve / --ctp-mocha-mauve)Accent color, mapped from the active semantic color.
--bg-elevatedfrom theme (--ctp-latte-surface0 / --ctp-mocha-surface0)Background of floating surfaces (modals, dropdowns, popovers).
--borderfrom theme (--ctp-latte-surface0 / --ctp-mocha-surface0)Outline and divider color for surfaces.
--textfrom theme (--ctp-latte-text / --ctp-mocha-text)Primary text color used inside the component.
--cp-easecubic-bezier(.4, 0, .2, 1)Default easing curve for transitions.

Ver Theming para la convención completa.