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
Primitives
Sonner
Toast notifications in the theme.
import { toast } from "sonner"
import { Button } from "@/registry/vcare/ui/button"
import { Toaster } from "@/registry/vcare/ui/sonner"
export default function SonnerDemo() {
return (
<>
<Toaster />
<div className="flex flex-wrap justify-center gap-2">
<Button variant="outline" onClick={() => toast.success("Bill saved", { description: "INV-2041 · ₹1,250" })}>Success</Button>
<Button variant="outline" onClick={() => toast.error("Could not print the label")}>Error</Button>
<Button variant="outline" onClick={() => toast("Token 15 called", { action: { label: "Undo", onClick: () => undefined } })}>With action</Button>
</div>
</>
)
}Installation
npx shadcn@latest add @vcare/sonnerOr install directly from the URL: https://ui.vcarehms.com/r/sonner.json
- Install the dependencies:
npm i lucide-react sonner - Add the registry items it uses: i18n, theme-provider.
- Copy this file into your project and change the
@/registry/vcare/…imports to your own paths.
components/ui/sonner.tsx
import type { CSSProperties } from 'react';
import { useTranslation } from '@/registry/vcare/lib/i18n';
import { CircleCheck, CircleX, Info, LoaderCircle, TriangleAlert } from 'lucide-react';
import { Toaster as Sonner } from 'sonner';
import { useTheme } from '@/registry/vcare/lib/theme-provider';
/** One themed notification surface shared by the clinical and platform workspaces. */
export function Toaster() {
const { theme } = useTheme();
const { t, i18n } = useTranslation();
return (
<Sonner
position="bottom-center"
containerAriaLabel={t('notifications')}
theme={theme.mode}
dir={i18n.dir()}
closeButton
icons={{
success: <CircleCheck className="size-4 text-success" />,
error: <CircleX className="size-4 text-destructive" />,
warning: <TriangleAlert className="size-4 text-(--tag-amber-text)" />,
info: <Info className="size-4 text-(--tag-blue-text)" />,
loading: <LoaderCircle className="size-4 animate-spin" />,
}}
toastOptions={{
closeButtonAriaLabel: t('close'),
classNames: {
toast: 'font-sans! shadow-overlay',
title: 'font-medium!',
description: 'text-muted-foreground!',
},
style: {
'--normal-bg': 'var(--popover)',
'--normal-text': 'var(--popover-foreground)',
'--normal-border': 'var(--border)',
'--border-radius': 'var(--radius-xl)',
} as CSSProperties,
}}
/>
);
}Usage
import { Toaster } from "@/components/ui/sonner"Exports
Toaster
Dependencies
lucide-react@^1.80.0(npm)sonner@^2.0.8(npm)@vcare/i18n(registry)@vcare/theme-provider(registry)
Raw item: /r/sonner.json