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
Page Header
The page title row with a status chip, actions, tools and tabs.
import { Bell, Plus } from "lucide-react"
import { Button } from "@/registry/vcare/ui/button"
import { HeaderChip, PageHeader } from "@/registry/vcare/ui/page-header"
import { PageTabsList } from "@/registry/vcare/ui/page-tabs"
import { Tabs } from "@/registry/vcare/ui/tabs"
export default function PageHeaderDemo() {
return (
<div className="w-full overflow-hidden rounded-xl border bg-background">
<Tabs defaultValue="today">
<PageHeader
title="Lab today"
badge={<HeaderChip>12 waiting</HeaderChip>}
actions={<Button><Plus /> New lab visit</Button>}
tools={<Button size="icon" variant="ghost" aria-label="Notifications"><Bell /></Button>}
tabs={
<PageTabsList
items={[
{ value: "today", label: "Today" },
{ value: "collected", label: "Collected" },
{ value: "reported", label: "Reported" },
]}
/>
}
/>
</Tabs>
</div>
)
}Installation
npx shadcn@latest add @vcare/page-headerOr install directly from the URL: https://ui.vcarehms.com/r/page-header.json
- Add the registry items it uses: embedded, sidebar.
- Copy this file into your project and change the
@/registry/vcare/…imports to your own paths.
components/ui/page-header.tsx
import type { ReactNode } from 'react';
import { SidebarTrigger } from '@/registry/vcare/ui/sidebar';
import { useEmbedded } from '@/registry/vcare/ui/embedded';
/** Title row (+ optional status chip, actions, tools and underline tabs). Every page starts with this. */
export function PageHeader({
title,
badge,
actions,
tools,
tabs,
logo,
sidebarTrigger = false,
}: {
title: string;
badge?: ReactNode;
actions?: ReactNode;
/** Icon buttons on the far end (notifications, language, theme). */
tools?: ReactNode;
tabs?: ReactNode;
logo?: string;
/** Show the sidebar toggle (needs a SidebarProvider above). */
sidebarTrigger?: boolean;
}) {
const embedded = useEmbedded();
if (embedded)
return tabs ? <header className="shrink-0 border-b px-4">{tabs}</header> : null;
return (
<header className="relative shrink-0 overflow-hidden border-b border-border/70">
<div className="relative flex min-h-header flex-wrap items-center justify-between gap-x-3 gap-y-2 px-4 pt-4 pb-3 sm:flex-nowrap sm:px-6">
<div className="flex min-w-0 flex-1 items-center gap-2.5 sm:flex-none">
{sidebarTrigger && <SidebarTrigger className="-ms-1 text-subtle hover:text-foreground" />}
{logo && <img src={logo} alt="" className="size-8 shrink-0 rounded-xl object-cover shadow-raised" />}
<h1 className="truncate text-xl leading-8 font-extrabold tracking-tight sm:text-[26px]">{title}</h1>
{badge && <span className="hidden sm:contents">{badge}</span>}
</div>
<div className="contents sm:flex sm:items-center sm:gap-2">
{actions && (
<div className="scrollbar-none order-last flex w-full items-center gap-2 overflow-x-auto pb-0.5 sm:order-none sm:w-auto sm:overflow-visible sm:pb-0 [&>*]:shrink-0">{actions}</div>
)}
{tools && <div className="flex items-center gap-1.5">{tools}</div>}
</div>
</div>
{tabs && <div className="relative px-4 sm:px-6">{tabs}</div>}
</header>
);
}
/** Small muted chip with a status dot, e.g. "● Active" next to a page title. */
export function HeaderChip({ children }: { children: ReactNode }) {
return (
<span className="inline-flex shrink-0 items-center gap-1.5 rounded-full bg-card/80 px-2.5 py-1 text-xs leading-none font-medium text-soft shadow-raised">
<span className="size-1.5 rounded-full bg-success" />
{children}
</span>
);
}Usage
import { PageHeader, HeaderChip } from "@/components/ui/page-header"Exports
PageHeader, HeaderChip
Dependencies
@vcare/embedded(registry)@vcare/sidebar(registry)
Raw item: /r/page-header.json