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
List Page
A complete list screen: header, toolbar, search, table and footer count.
import { Plus } from "lucide-react"
import { Button } from "@/registry/vcare/ui/button"
import { HeaderChip } from "@/registry/vcare/ui/page-header"
import { ListPage } from "@/registry/vcare/ui/list-page"
import { FilterSelect } from "@/registry/vcare/ui/page-toolbar"
import { PersonCell } from "@/registry/vcare/ui/person-cell"
import { Tag } from "@/registry/vcare/ui/tag"
import type { DataTableColumnDef } from "@/registry/vcare/ui/data-table"
import { useState } from "react"
type Patient = { id: string; name: string; mrn: string; age: number; department: string; status: "Waiting" | "With doctor" | "Done"; billed: number }
const patients: Patient[] = [
{ id: "1", name: "Meera Raghavan", mrn: "00482", age: 34, department: "General medicine", status: "With doctor", billed: 1250 },
{ id: "2", name: "Arjun Nair", mrn: "00483", age: 52, department: "Orthopaedics", status: "Waiting", billed: 480 },
{ id: "3", name: "Sana Iqbal", mrn: "00484", age: 27, department: "Gynaecology", status: "Done", billed: 3900 },
{ id: "4", name: "Joseph Mathew", mrn: "00485", age: 61, department: "Cardiology", status: "Waiting", billed: 2200 },
{ id: "5", name: "Fathima Rahim", mrn: "00486", age: 8, department: "Paediatrics", status: "Done", billed: 650 },
{ id: "6", name: "Vivek Menon", mrn: "00487", age: 45, department: "General medicine", status: "With doctor", billed: 900 },
{ id: "7", name: "Anjali Das", mrn: "00488", age: 39, department: "Physiotherapy", status: "Waiting", billed: 700 },
]
const tone = { Waiting: "amber", "With doctor": "blue", Done: "green" } as const
const columns: DataTableColumnDef<Patient>[] = [
{ accessorKey: "name", header: "Patient", cell: ({ row }) => <PersonCell name={row.original.name} sub={`MRN ${row.original.mrn} · ${row.original.age} y`} /> },
{ accessorKey: "department", header: "Department" },
{ accessorKey: "status", header: "Status", cell: ({ row }) => <Tag color={tone[row.original.status]}>{row.original.status}</Tag> },
{ accessorKey: "billed", header: "Billed", cell: ({ row }) => <span className="tabular-nums">₹{row.original.billed.toLocaleString("en-IN")}</span> },
]
export default function ListPageDemo() {
const [dept, setDept] = useState("")
const rows = dept ? patients.filter((p) => p.department === dept) : patients
return (
<div className="flex h-[560px] w-full flex-col overflow-hidden rounded-xl border bg-background">
<ListPage
title="Patients"
badge={<HeaderChip>Live</HeaderChip>}
actions={<Button><Plus /> New patient</Button>}
filters={
<FilterSelect
label="Department"
value={dept}
onChange={setDept}
allLabel="All"
options={[...new Set(patients.map((p) => p.department))].map((d) => ({ value: d, label: d }))}
/>
}
columns={columns}
data={rows}
countLabel={(n) => `${n} patients`}
/>
</div>
)
}Installation
npx shadcn@latest add @vcare/list-pageOr install directly from the URL: https://ui.vcarehms.com/r/list-page.json
- Add the registry items it uses: data-table, i18n, page-header, page-toolbar, search-input, table-footer.
- Copy this file into your project and change the
@/registry/vcare/…imports to your own paths.
components/ui/list-page.tsx
import { useState, type ReactNode } from 'react';
import { useTranslation } from '@/registry/vcare/lib/i18n';
import type { DataTableColumnDef } from '@/registry/vcare/ui/data-table';
import { DataTableContent, DataTablePagination, useDataTable } from '@/registry/vcare/ui/data-table';
import { PageHeader } from '@/registry/vcare/ui/page-header';
import { PageToolbar } from '@/registry/vcare/ui/page-toolbar';
import { TableFooterBar } from '@/registry/vcare/ui/table-footer';
import { SearchInput } from '@/registry/vcare/ui/search-input';
/**
* Standard list screen: header (title, chip, tabs), toolbar (filters left, actions right), table, footer count.
* Every list in the app is built from this so spacing, density and behaviour stay identical.
*/
export function ListPage<T extends { id: string }>({
title,
badge,
tabs,
filters,
actions,
columns,
data,
loading,
fetching,
onRowClick,
countLabel,
selectable,
pageSize = 25,
empty,
top,
children,
}: {
title: string;
badge?: ReactNode;
tabs?: ReactNode;
filters?: ReactNode;
actions?: ReactNode;
columns: DataTableColumnDef<T>[];
data: T[];
loading?: boolean;
fetching?: boolean;
onRowClick?: (row: T) => void;
countLabel?: (n: number) => string;
selectable?: boolean;
pageSize?: number;
empty?: string;
/** Shown above the table card (e.g. a department's queue). */
top?: ReactNode;
children?: ReactNode;
}) {
const { t } = useTranslation();
const [search, setSearch] = useState('');
const visibleData =
filters || !search.trim()
? data
: data.filter((row) =>
Object.values(row).some(
(value) => (typeof value === 'string' || typeof value === 'number') && String(value).toLowerCase().includes(search.trim().toLowerCase()),
),
);
const table = useDataTable({
columns: columns as never,
data: visibleData,
pageSize,
enableRowSelection: selectable,
getRowId: (r: T) => r.id,
});
return (
<div className="flex min-h-0 flex-1 flex-col">
<PageHeader title={title} badge={badge} tabs={tabs} />
<div className="flex min-h-0 flex-1 flex-col gap-4 px-6 pt-4 pb-5">
{top}
{/* One white card holds the filters, the table and the footer, like a card on the app's grey page. */}
<div className="flex min-h-0 flex-1 flex-col overflow-hidden rounded-3xl bg-card shadow-border">
<PageToolbar actions={actions}>{filters ?? <SearchInput value={search} onChange={setSearch} placeholder={t('search')} />}</PageToolbar>
<div className="min-h-0 flex-1 overflow-auto" data-tour="page-table">
<DataTableContent
table={table as never}
density="compact"
stickyHeader
loading={loading}
pending={fetching}
emptyMessage={empty ?? t('empty')}
onRowClick={onRowClick ? (row) => onRowClick((row as { original: T }).original) : undefined}
/>
</div>
<TableFooterBar>
<span>{countLabel ? countLabel(visibleData.length) : t('inView', { count: visibleData.length })}</span>
<DataTablePagination table={table as never} className="ms-auto" />
</TableFooterBar>
</div>
</div>
{children}
</div>
);
}Usage
import { ListPage } from "@/components/ui/list-page"Exports
ListPage
Dependencies
@vcare/data-table(registry)@vcare/i18n(registry)@vcare/page-header(registry)@vcare/page-toolbar(registry)@vcare/search-input(registry)@vcare/table-footer(registry)
Raw item: /r/list-page.json