Documentation menu
Getting Started
Components
Primitives
- Agent Thinking
- Alert
- Alert Dialog
- Avatar
- Badge
- Breadcrumb
- Button
- Button Group
- Calendar
- Card
- Checkbox
- Command
- Command Palette
- Context Menu
- Data Table
- Dialog
- Dropdown Menu
- Empty
- Field
- Glow Cloud
- Input
- Label
- Medication Schedule
- Period Tabs
- Popover
- Rainbow Button
- Scroll Area
- Select
- Selectable Card
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Spinner
- Switch
- Table
- Tabs
- Tag
- Textarea
- Timeline
- Tooltip
- Use Count Up
Charts and metrics
Patterns
- Confirm Button
- Date Picker
- Embedded
- Empty State
- Entity Drawer
- Error Boundary
- Field Row
- File Dropzone
- Form Dialog
- Kv
- List Editor
- List Page
- Live Time
- Mini Table
- Money
- Note Field
- Note Text
- Page Card
- Page Header
- Page Tabs
- Page Toolbar
- Person Cell
- Picture Field
- Print Card
- Range Switcher
- Row Actions
- Search Input
- Search Select
- Selected Box
- Signature Pad
- Status Badge
- Sub Nav Layout
- Suggest Input
- Tab Icons
- Table Footer
- Theme Accent Picker
- Time Picker
- View All Link
Dashboard cards
Advanced
Device frames
Website widgets
Website screens
Website panels
Dashboard cards
Alerts Card
A list of alerts with severity and time.
import { CircleAlert, FlaskConical, Pill, TriangleAlert } from "lucide-react"
import { AlertsCard } from "@/registry/vcare/ui/alerts-card"
export default function AlertsCardDemo() {
return (
<AlertsCard
className="mx-auto max-w-md"
label="Alerts"
unit="open"
alerts={[
{ id: "1", icon: <CircleAlert />, tone: "critical", title: "Critical potassium", body: "Joseph Mathew · 6.4 mmol/L", date: "9:42" },
{ id: "2", icon: <Pill />, tone: "warning", title: "Low stock: Amoxicillin 500", body: "12 strips left", date: "8:15" },
{ id: "3", icon: <FlaskConical />, tone: "info", title: "Reports ready", body: "3 released", date: "Yesterday" },
{ id: "4", icon: <TriangleAlert />, tone: "success", title: "Backup completed", date: "Yesterday" },
]}
/>
)
}Installation
npx shadcn@latest add @vcare/alerts-cardOr install directly from the URL: https://ui.vcarehms.com/r/alerts-card.json
- Add the registry items it uses: insight-card, utils.
- Copy this file into your project and change the
@/registry/vcare/…imports to your own paths.
components/ui/alerts-card.tsx
import * as React from 'react';
import { InsightCard } from '@/registry/vcare/ui/insight-card';
import { cn } from '@/registry/vcare/lib/utils';
export interface AlertEntry {
id: string;
icon: React.ReactNode;
tone?: 'critical' | 'warning' | 'info' | 'success';
title: string;
body?: string;
/** Pre-formatted, shown in a pill at the top right of the entry. */
date: string;
}
const TONE = {
critical: 'bg-destructive',
warning: 'bg-warning',
info: 'bg-primary text-primary-foreground',
success: 'bg-success',
} as const;
interface Props {
alerts: AlertEntry[];
label?: string;
count?: number;
unit?: string;
action?: React.ReactNode;
onSelect?: (alert: AlertEntry) => void;
className?: string;
}
/** Important alerts: a solid colored icon, the date in a pill, a title and two lines of detail. */
export function AlertsCard({ alerts, label, count = alerts.length, unit, action, onSelect, className }: Props) {
return (
<InsightCard className={className} label={label} value={count} unit={unit} action={action}>
<ul className="flex flex-col gap-2">
{alerts.map((a) => {
const body = (
<>
<span className="flex items-start justify-between gap-3">
<span className={cn('grid size-10 place-items-center rounded-full text-white [&>svg]:size-5', TONE[a.tone ?? 'info'])}>{a.icon}</span>
<span className="rounded-lg bg-muted px-2 py-1 text-xs text-muted-foreground">{a.date}</span>
</span>
<span className="mt-2 block text-sm font-medium">{a.title}</span>
{a.body && <span className="mt-0.5 line-clamp-3 block text-sm text-muted-foreground">{a.body}</span>}
</>
);
return (
<li key={a.id}>
{onSelect ? (
<button
type="button"
onClick={() => onSelect(a)}
className="block w-full rounded-2xl bg-secondary p-3 text-start outline-none transition-colors hover:bg-muted/60 focus-visible:ring-2 focus-visible:ring-ring/50"
>
{body}
</button>
) : (
<div className="rounded-2xl bg-secondary p-3">{body}</div>
)}
</li>
);
})}
</ul>
</InsightCard>
);
}Usage
import { AlertsCard } from "@/components/ui/alerts-card"Exports
AlertsCard
Dependencies
@vcare/insight-card(registry)@vcare/utils(registry)
Raw item: /r/alerts-card.json