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
Combo Chart Card
Bars and a line on two axes, with headline tiles.
import { useState } from "react"
import { ComboChartCard } from "@/registry/vcare/ui/combo-chart-card"
const data = [
{ month: "Jan", visits: 412, revenue: 18.2 }, { month: "Feb", visits: 468, revenue: 20.1 }, { month: "Mar", visits: 501, revenue: 22.4 },
{ month: "Apr", visits: 455, revenue: 19.8 }, { month: "May", visits: 590, revenue: 26.3 }, { month: "Jun", visits: 642, revenue: 28.9 },
]
export default function ComboChartCardDemo() {
const [period, setPeriod] = useState("6m")
return (
<ComboChartCard
className="w-full"
label="Visits and revenue"
value="3,068"
unit="visits"
periods={[{ value: "3m", label: "3M" }, { value: "6m", label: "6M" }, { value: "1y", label: "1Y" }]}
period={period}
onPeriodChange={setPeriod}
data={data}
xKey="month"
rightYFormatter={(v) => `₹${v}L`}
series={[
{ key: "visits", label: "Visits", type: "bar" },
{ key: "revenue", label: "Revenue", type: "line", axis: "right" },
]}
tiles={[
{ label: "Visits", value: "3,068", color: "var(--chart-1)" },
{ label: "Revenue", value: "₹135.7L", color: "var(--chart-2)" },
]}
/>
)
}Installation
npx shadcn@latest add @vcare/combo-chart-cardOr install directly from the URL: https://ui.vcarehms.com/r/combo-chart-card.json
- Add the registry items it uses: composed-chart, insight-card, period-tabs, utils.
- Copy this file into your project and change the
@/registry/vcare/…imports to your own paths.
components/ui/combo-chart-card.tsx
import { InsightCard } from '@/registry/vcare/ui/insight-card';
import { ComposedChart, type ComposedChartProps } from '@/registry/vcare/ui/composed-chart';
import { PeriodTabs, type PeriodOption } from '@/registry/vcare/ui/period-tabs';
import { cn } from '@/registry/vcare/lib/utils';
export interface ComboTile {
label: string;
value: string;
color?: string;
}
interface Props extends Pick<ComposedChartProps, 'data' | 'xKey' | 'series' | 'xFormatter' | 'yFormatter' | 'rightYFormatter' | 'referenceLines'> {
label?: string;
value?: React.ReactNode;
unit?: React.ReactNode;
periods?: PeriodOption[];
period?: string;
onPeriodChange?: (period: string) => void;
tiles?: ComboTile[];
className?: string;
chartClassName?: string;
}
/** Bars on the left axis and a line on the right, with tiles for the headline numbers. Series choose their axis with `axis`. */
export function ComboChartCard({ label, value, unit, periods, period, onPeriodChange, tiles, className, chartClassName, ...chart }: Props) {
return (
<InsightCard
className={className}
label={label}
value={value}
unit={unit}
action={periods ? <PeriodTabs options={periods} value={period} onValueChange={onPeriodChange} animated /> : undefined}
>
{tiles && tiles.length > 0 && (
<div className="grid grid-flow-col auto-cols-fr gap-2">
{tiles.map((t) => (
<div key={t.label} className="rounded-xl bg-secondary px-3 py-2.5">
<p className="flex items-center gap-1.5 text-sm text-muted-foreground">
{t.color && <span aria-hidden className="size-3 rounded-[4px]" style={{ backgroundColor: t.color }} />}
{t.label}
</p>
<p className="mt-0.5 text-base font-medium tabular-nums">{t.value}</p>
</div>
))}
</div>
)}
<ComposedChart className={cn('aspect-auto h-60 w-full', chartClassName)} {...chart} />
</InsightCard>
);
}Usage
import { ComboChartCard } from "@/components/ui/combo-chart-card"Exports
ComboChartCard
Dependencies
@vcare/composed-chart(registry)@vcare/insight-card(registry)@vcare/period-tabs(registry)@vcare/utils(registry)
Raw item: /r/combo-chart-card.json