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
Activity Rings Card
Activity rings with the stats beside them.
import { ActivityRingsCard } from "@/registry/vcare/ui/activity-rings-card"
export default function ActivityRingsCardDemo() {
return (
<ActivityRingsCard
className="mx-auto max-w-lg"
title="Today's activity"
stats={[
{ label: "Move", value: "420 kcal", ring: { label: "Move", value: 420, max: 500 } },
{ label: "Exercise", value: "24 min", ring: { label: "Exercise", value: 24, max: 30 } },
{ label: "Stand", value: "9 h", ring: { label: "Stand", value: 9, max: 12 } },
]}
/>
)
}Installation
npx shadcn@latest add @vcare/activity-rings-cardOr install directly from the URL: https://ui.vcarehms.com/r/activity-rings-card.json
- Add the registry items it uses: activity-rings, insight-card, utils.
- Copy this file into your project and change the
@/registry/vcare/…imports to your own paths.
components/ui/activity-rings-card.tsx
import { useState } from 'react';
import { InsightCard } from '@/registry/vcare/ui/insight-card';
import { ActivityRings, type ActivityRing } from '@/registry/vcare/ui/activity-rings';
import { cn } from '@/registry/vcare/lib/utils';
export interface ActivityStat {
label: string;
/** Formatted value with its unit, e.g. "816 kcal". */
value: string;
/** Ring this stat belongs to. Its color tints the label dot. */
ring: ActivityRing;
}
interface Props {
title: string;
stats: ActivityStat[];
size?: number;
className?: string;
}
/** Goal rings with a tile per ring above them. Hovering a tile or a ring highlights the pair. */
export function ActivityRingsCard({ title, stats, size = 220, className }: Props) {
const [active, setActive] = useState<number | null>(null);
const colors = ['var(--chart-1)', 'var(--chart-2)', 'var(--chart-3)', 'var(--chart-4)', 'var(--chart-5)'];
return (
<InsightCard className={className} label={title}>
<div className="grid grid-flow-col auto-cols-fr gap-2">
{stats.map((s, i) => (
<div
key={s.label}
onMouseEnter={() => setActive(i)}
onMouseLeave={() => setActive(null)}
className={cn('rounded-xl bg-secondary px-3 py-2.5 transition-opacity', active !== null && active !== i && 'opacity-60')}
>
<p className="flex items-center gap-1.5 text-sm text-muted-foreground">
<span aria-hidden className="size-3 rounded-[4px]" style={{ backgroundColor: s.ring.color ?? colors[i % colors.length] }} />
{s.label}
</p>
<p className="mt-0.5 text-base font-medium tabular-nums">{s.value}</p>
</div>
))}
</div>
<div className="flex justify-center py-2">
<ActivityRings
rings={stats.map((s, i) => ({ ...s.ring, color: s.ring.color ?? colors[i % colors.length] }))}
size={size}
thickness={size / 9}
gap={size / 36}
activeIndex={active}
onActiveIndexChange={setActive}
/>
</div>
</InsightCard>
);
}Usage
import { ActivityRingsCard } from "@/components/ui/activity-rings-card"Exports
ActivityRingsCard
Dependencies
@vcare/activity-rings(registry)@vcare/insight-card(registry)@vcare/utils(registry)
Raw item: /r/activity-rings-card.json