Skip to content

@vibe-labs/design-components-toasts

Toast notification component tokens, styles, and TypeScript types for the Vibe Design System.

Usage

css
@import "@vibe-labs/design-components-toasts";
ts
import { ToastVariants, ToastContainerPositions } from "@vibe-labs/design-components-toasts/types";
import type { ToastStyleProps, ToastContainerStyleProps } from "@vibe-labs/design-components-toasts/types";

Contents

Tokens (toast.css)

CSS custom properties defined in @layer vibe.tokens:

Sizing

TokenDefault
--toast-max-width24rem
--toast-min-width16rem
--toast-padding-x--space-4
--toast-padding-y--space-3
--toast-gap--space-3

Appearance

TokenDefault
--toast-radius--radius-lg
--toast-bg--surface-elevated
--toast-color--text-primary
--toast-border-color--border-subtle
--toast-border-width--border-width-1
--toast-shadow--shadow-lg

Container

TokenDefault
--toast-container-gap--space-2
--toast-container-inset--space-4
--toast-z--z-toast (600)

Generated Styles (toast.g.css)

Component classes generated into @layer vibe.components.

Toast

Flex row with icon, content, and close button slots. Container has pointer-events: none, individual toasts restore pointer-events: auto.

Variants

VariantAccent colorBackground
success--color-success--surface-success-subtle
warning--color-warning--surface-warning-subtle
danger--color-danger--surface-danger-subtle
info--color-info--surface-info-subtle

All variants use a 3px left border accent.

Sections

  • toast-icon — leading status icon (1.25rem)
  • toast-content — flex-grow content wrapper
  • toast-title — semibold heading
  • toast-description — muted body text
  • toast-actions — flex row for action buttons

Container Positions

PositionPlacement
top-rightFixed top-right, right-aligned
top-leftFixed top-left, left-aligned
top-centerFixed top-center, centered
bottom-rightFixed bottom-right, right-aligned
bottom-leftFixed bottom-left, left-aligned
bottom-centerFixed bottom-center, centered

Animation

  • entering — slide-in-right
  • exiting — fade-out with forwards fill

TypeScript Types (types/)

ts
ToastVariants           // ["success", "warning", "danger", "info"]
ToastContainerPositions // ["top-right", "top-left", "top-center",
                        //  "bottom-right", "bottom-left", "bottom-center"]

type ToastVariant
type ToastContainerPosition

interface ToastStyleProps { variant?: ToastVariant; entering?: boolean; exiting?: boolean }
interface ToastIconStyleProps {}
interface ToastContentStyleProps {}
interface ToastTitleStyleProps {}
interface ToastDescriptionStyleProps {}
interface ToastActionsStyleProps {}
interface ToastContainerStyleProps { position?: ToastContainerPosition }

Dist Structure

FileDescription
index.cssBarrel — imports tokens + generated styles
toast.cssToken definitions
toast.g.cssGenerated component styles
index.js / index.d.tsTypeScript types + runtime constants

Dependencies

Requires tokens from @vibe-labs/design (colors, surfaces, borders, spacing, typography, elevation, transitions, z-index).

Build

bash
npm run build