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
Entity Drawer
A detail drawer: header, scrollable sections and an action footer.
import { useState } from "react"
import { User } from "lucide-react"
import { Button } from "@/registry/vcare/ui/button"
import { DrawerSection, EntityDrawer } from "@/registry/vcare/ui/entity-drawer"
import { KV } from "@/registry/vcare/ui/kv"
export default function EntityDrawerDemo() {
const [open, setOpen] = useState(false)
return (
<>
<Button variant="outline" onClick={() => setOpen(true)}>Open patient</Button>
<EntityDrawer open={open} onOpenChange={setOpen} title="Meera Raghavan" icon={<User className="size-4" />} footer={<Button>Start visit</Button>}>
<DrawerSection title="Details">
<div className="grid grid-cols-2 gap-2">
<KV label="MRN">00482</KV>
<KV label="Age">34</KV>
<KV label="Mobile">90000 00000</KV>
<KV label="Blood group">B+</KV>
</div>
</DrawerSection>
<DrawerSection title="Allergies">
<p className="text-sm">Penicillin</p>
</DrawerSection>
</EntityDrawer>
</>
)
}Installation
npx shadcn@latest add @vcare/entity-drawerOr install directly from the URL: https://ui.vcarehms.com/r/entity-drawer.json
- Install the dependencies:
npm i lucide-react - Add the registry items it uses: button, i18n, sheet.
- Copy this file into your project and change the
@/registry/vcare/…imports to your own paths.
components/ui/entity-drawer.tsx
import type { ReactNode } from 'react';
import { useTranslation } from '@/registry/vcare/lib/i18n';
import { X } from 'lucide-react';
import { Button } from '@/registry/vcare/ui/button';
import { Sheet, SheetClose, SheetContent, SheetDescription, SheetHeader, SheetTitle } from '@/registry/vcare/ui/sheet';
/** Detail drawer on the end side (reference "Companies Detail"): header, scrollable sections, action footer. */
export function EntityDrawer({
open,
onOpenChange,
title,
icon,
footer,
footerStart,
tabs,
children,
}: {
open: boolean;
onOpenChange: (o: boolean) => void;
title: string;
icon?: ReactNode;
footer?: ReactNode;
footerStart?: ReactNode;
/** Section tabs for a long drawer: fixed under the header while the body scrolls. */
tabs?: ReactNode;
children: ReactNode;
}) {
const { t, i18n } = useTranslation();
return (
<Sheet open={open} onOpenChange={onOpenChange}>
<SheetContent
side={i18n.dir() === 'rtl' ? 'left' : 'right'}
showCloseButton={false}
floating
className="flex flex-col gap-0 overflow-hidden p-0 sm:max-w-[38rem]"
>
<SheetHeader className="h-14 shrink-0 flex-row items-center gap-2 border-b px-5 py-0">
{icon}
<SheetTitle className="min-w-0 flex-1 truncate text-sm font-medium">{title}</SheetTitle>
<SheetDescription className="sr-only">{title}</SheetDescription>
<SheetClose asChild>
<Button type="button" variant="ghost" size="icon-sm" aria-label={t('close')}>
<X />
</Button>
</SheetClose>
</SheetHeader>
{tabs && <div className="shrink-0 border-b px-5">{tabs}</div>}
<div className="flex-1 overflow-y-auto">{children}</div>
{(footer || footerStart) && (
<div className="flex shrink-0 items-center justify-between gap-2 border-t px-5 py-3.5">
<div className="text-xs">{footerStart}</div>
<div className="flex items-center gap-2">{footer}</div>
</div>
)}
</SheetContent>
</Sheet>
);
}
export function DrawerSection({ title, action, children }: { title: string; action?: ReactNode; children: ReactNode }) {
return (
<section className="border-b px-5 py-4 last:border-b-0">
<div className="mb-3 flex items-center justify-between">
<h3 className="text-eyebrow text-soft">{title}</h3>
{action}
</div>
{children}
</section>
);
}Usage
import { EntityDrawer, DrawerSection } from "@/components/ui/entity-drawer"Exports
EntityDrawer, DrawerSection
Dependencies
lucide-react@^1.80.0(npm)@vcare/button(registry)@vcare/i18n(registry)@vcare/sheet(registry)
Raw item: /r/entity-drawer.json