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
Table
Plain table parts for small, static tables.
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/registry/vcare/ui/table"
const rows = [
["INV-2041", "Meera Raghavan", "₹1,250"],
["INV-2042", "Arjun Nair", "₹480"],
["INV-2043", "Sana Iqbal", "₹3,900"],
]
export default function TableDemo() {
return (
<Table className="mx-auto max-w-lg">
<TableHeader>
<TableRow>
<TableHead>Invoice</TableHead>
<TableHead>Patient</TableHead>
<TableHead className="text-end">Amount</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{rows.map(([a, b, c]) => (
<TableRow key={a}>
<TableCell className="font-medium">{a}</TableCell>
<TableCell>{b}</TableCell>
<TableCell className="text-end tabular-nums">{c}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
)
}Installation
npx shadcn@latest add @vcare/tableOr install directly from the URL: https://ui.vcarehms.com/r/table.json
- Add the registry items it uses: utils.
- Copy this file into your project and change the
@/registry/vcare/…imports to your own paths.
components/ui/table.tsx
import * as React from 'react';
import { cn } from '@/registry/vcare/lib/utils';
function Table({ className, ...props }: React.ComponentProps<'table'>) {
return (
<div data-slot="table-container" className="relative w-full overflow-x-auto">
<table data-slot="table" className={cn('w-full bg-card caption-bottom text-sm', className)} {...props} />
</div>
);
}
function TableHeader({ className, ...props }: React.ComponentProps<'thead'>) {
return <thead data-slot="table-header" className={cn('bg-muted/60 [&_tr]:border-b', className)} {...props} />;
}
function TableBody({ className, ...props }: React.ComponentProps<'tbody'>) {
return <tbody data-slot="table-body" className={cn('[&_tr:last-child]:border-0', className)} {...props} />;
}
function TableFooter({ className, ...props }: React.ComponentProps<'tfoot'>) {
return <tfoot data-slot="table-footer" className={cn('border-t bg-muted/50 font-medium [&>tr]:last:border-b-0', className)} {...props} />;
}
function TableRow({ className, ...props }: React.ComponentProps<'tr'>) {
return (
<tr
data-slot="table-row"
className={cn(
'border-b border-border transition-colors duration-150 ease-power3-out hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-accent',
className,
)}
{...props}
/>
);
}
function TableHead({ className, ...props }: React.ComponentProps<'th'>) {
return (
<th
data-slot="table-head"
className={cn(
'h-head px-4 text-start align-middle text-[11px] font-semibold tracking-wide whitespace-nowrap text-subtle uppercase [&:has([role=checkbox])]:pe-0 [&>[role=checkbox]]:translate-y-[2px]',
className,
)}
{...props}
/>
);
}
function TableCell({ className, ...props }: React.ComponentProps<'td'>) {
return (
<td
data-slot="table-cell"
className={cn(
'h-row px-4 py-0 align-middle text-sm leading-none whitespace-nowrap [&:has([role=checkbox])]:pe-0 [&>[role=checkbox]]:translate-y-[2px]',
className,
)}
{...props}
/>
);
}
function TableCaption({ className, ...props }: React.ComponentProps<'caption'>) {
return <caption data-slot="table-caption" className={cn('mt-4 text-sm text-muted-foreground', className)} {...props} />;
}
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption };Usage
import { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow } from "@/components/ui/table"Exports
Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption
Dependencies
@vcare/utils(registry)
Raw item: /r/table.json