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
Patterns
Mini Table
A light table for tabs and drawers, without sorting or paging.
import { MiniTable } from "@/registry/vcare/ui/mini-table"
const rows = [
{ id: "1", date: "12 Nov", test: "HbA1c", result: "6.8 %" },
{ id: "2", date: "12 Nov", test: "Fasting glucose", result: "128 mg/dL" },
{ id: "3", date: "2 Oct", test: "HbA1c", result: "7.2 %" },
]
export default function MiniTableDemo() {
return (
<div className="w-full max-w-md rounded-xl border">
<MiniTable
rows={rows}
columns={[
{ key: "date", header: "Date", cell: (r) => r.date },
{ key: "test", header: "Test", cell: (r) => r.test },
{ key: "result", header: "Result", cell: (r) => <span className="tabular-nums">{r.result}</span>, className: "text-end" },
]}
/>
</div>
)
}Installation
npx shadcn@latest add @vcare/mini-tableOr install directly from the URL: https://ui.vcarehms.com/r/mini-table.json
- Add the registry items it uses: empty-state, i18n, table, utils.
- Copy this file into your project and change the
@/registry/vcare/…imports to your own paths.
components/ui/mini-table.tsx
import type { ReactNode } from 'react';
import { useTranslation } from '@/registry/vcare/lib/i18n';
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/registry/vcare/ui/table';
import { EmptyState } from '@/registry/vcare/ui/empty-state';
import { cn } from '@/registry/vcare/lib/utils';
export interface MiniColumn<T> {
key: string;
header: string;
cell: (row: T) => ReactNode;
className?: string;
}
/** Light table for tabs and drawers (no sorting/paging). For full lists use <ListPage/>. */
export function MiniTable<T extends { id: string }>({
columns,
rows,
onRowClick,
empty,
}: {
columns: MiniColumn<T>[];
rows: T[] | undefined;
onRowClick?: (row: T) => void;
empty?: string;
}) {
const { t } = useTranslation();
if (rows && !rows.length) return <EmptyState title={empty ?? t('empty')} />;
return (
<Table>
<TableHeader>
<TableRow className="hover:bg-transparent">
{columns.map((c) => (
<TableHead key={c.key} className={c.className}>
{c.header}
</TableHead>
))}
</TableRow>
</TableHeader>
<TableBody>
{(rows ?? []).map((r) => (
<TableRow key={r.id} onClick={onRowClick ? () => onRowClick(r) : undefined} className={cn(onRowClick && 'cursor-pointer')}>
{columns.map((c) => (
<TableCell key={c.key} className={c.className}>
{c.cell(r)}
</TableCell>
))}
</TableRow>
))}
</TableBody>
</Table>
);
}Usage
import { MiniTable } from "@/components/ui/mini-table"Exports
MiniTable
Dependencies
@vcare/empty-state(registry)@vcare/i18n(registry)@vcare/table(registry)@vcare/utils(registry)
Raw item: /r/mini-table.json