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
Website widgets
Donut Card
A health age score ring with the score in the middle and a legend.
import { DonutCard } from "@/registry/vcare/site/widgets/donut-card"
export default function SiteDonutCardDemo() {
// Sized as on the website: the widget fills the box it is given.
return (
<div className="vc-site grid place-items-center overflow-x-auto rounded-2xl bg-[#f5f6f8] p-6">
<div className="h-[260px] w-[250px]">
<DonutCard />
</div>
</div>
)
}Installation
npx shadcn@latest add @vcare/site-donut-cardOr install directly from the URL: https://ui.vcarehms.com/r/site-donut-card.json
- Install the dependencies:
npm i motion - Add the registry items it uses: site-theme.
- Copy this file into your project and change the
@/registry/vcare/…imports to your own paths.
components/site/widgets/donut-card.tsx
import { motion } from 'motion/react';
const card = 'rounded-2xl bg-white p-4 text-left shadow-[0_1px_2px_rgb(15_27_45/0.04),0_10px_28px_-10px_rgb(15_27_45/0.14)] ring-1 ring-black/[0.06]';
/** A health age score ring with the score in the middle and a legend. */
export function DonutCard() {
const segs: [string, string, number][] = [['#2f6fed', 'Cardio', 90], ['#e0245e', 'Metabolic', 78], ['#16a34a', 'Lifestyle', 76]];
const r = 38, c = 2 * Math.PI * r;
return (
<div className={`${card} h-full`}>
<p className="text-[12px] text-[#6b7280]">Health age score</p>
<p className="text-[18px] font-semibold text-ink">Excellent</p>
<div className="relative mx-auto mt-3 h-[104px] w-[104px]">
<svg viewBox="0 0 100 100" className="-rotate-90">
<circle cx="50" cy="50" r={r} fill="none" stroke="#eef0f3" strokeWidth="10" />
{segs.map(([col], i) => (
<motion.circle key={col} cx="50" cy="50" r={r} fill="none" stroke={col} strokeWidth="10" strokeLinecap="round" strokeDasharray={`${c * 0.28} ${c}`} strokeDashoffset={-c * 0.33 * i} initial={{ opacity: 0 }} whileInView={{ opacity: 1 }} viewport={{ once: true }} transition={{ delay: 0.3 + i * 0.2, duration: 0.6 }} />
))}
</svg>
<span className="absolute inset-0 grid place-items-center text-[22px] font-semibold text-ink">58</span>
</div>
<div className="mt-3 space-y-1.5">{segs.map(([col, l, v]) => <div key={l} className="flex items-center justify-between text-[11.5px]"><span className="flex items-center gap-2 text-[#4b5160]"><i className="h-2 w-2 rounded-full" style={{ background: col }} />{l}</span><span className="font-semibold text-ink">{v}</span></div>)}</div>
</div>
);
}Usage
import { DonutCard } from "@/components/site/widgets/donut-card"Exports
DonutCard
Dependencies
motion@^14.14.0(npm)@vcare/site-theme(registry)
Raw item: /r/site-donut-card.json