Alert

An Alert is used to display important information to the user. It is typically styled with a distinct color and icon to indicate the type of alert such as success, error, warning, or info.

  • Dismissable
  • Auto dismiss after 3 seconds
  • Success, error, warning, info variants
  • Animated transition

Installation

Run the following command

npx vibes@latest add alert

Usage

import { Alert } from '@/vibes/soul/primitives/alert';function Usage() {  return <Alert message="This is a success alert" variant="success" />;}

API Reference

AlertProps

nametypedefault
variant*
"success" | "warning" | "error" | "info"
message*
ReactNode
description
string
dismissLabel
string
"Dismiss"
action
{ label: string; onClick: () => void; }
onDismiss
() => void

CSS Variables

This component supports various CSS variables for theming. Here's a comprehensive list.

:root {  --alert-success-background: var(--success-highlight);  --alert-warning-background: var(--warning-highlight);  --alert-error-background: var(--error-highlight);  --alert-info-background: var(--background);  --alert-font-family: var(--font-family-body);  --alert-border: color-mix(in oklab, var(--foreground) 10%, transparent);  --alert-message-text: var(--foreground);  --alert-description-text: color-mix(in oklab, var(--foreground) 50%, transparent);}