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
Empty
An empty state with an illustration, title, description and actions.
import { Button } from "@/registry/vcare/ui/button"
import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyTitle } from "@/registry/vcare/ui/empty"
export default function EmptyDemo() {
return (
<Empty>
<EmptyHeader>
<EmptyTitle>No appointments today</EmptyTitle>
<EmptyDescription>New bookings show up here as they come in.</EmptyDescription>
</EmptyHeader>
<EmptyContent>
<Button>Book appointment</Button>
</EmptyContent>
</Empty>
)
}Installation
npx shadcn@latest add @vcare/emptyOr install directly from the URL: https://ui.vcarehms.com/r/empty.json
- Install the dependencies:
npm i class-variance-authority - Add the registry items it uses: art, utils.
- Copy this file into your project and change the
@/registry/vcare/…imports to your own paths.
components/ui/empty.tsx
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "@/registry/vcare/lib/utils"
import { art } from "@/registry/vcare/lib/art"
/** A page with nothing to show. Unless it brings its own icon it carries the app's empty-state picture. */
function Empty({ className, style, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="empty"
style={{ "--empty-art": `url(${art("states/empty-search")})`, ...style } as React.CSSProperties}
className={cn(
"flex min-w-0 flex-1 flex-col items-center justify-center gap-6 rounded-2xl border-dashed p-6 text-center text-balance md:p-12",
"not-has-[[data-slot=empty-icon]]:before:block not-has-[[data-slot=empty-icon]]:before:h-32 not-has-[[data-slot=empty-icon]]:before:w-44 not-has-[[data-slot=empty-icon]]:before:bg-(image:--empty-art) not-has-[[data-slot=empty-icon]]:before:bg-contain not-has-[[data-slot=empty-icon]]:before:bg-center not-has-[[data-slot=empty-icon]]:before:bg-no-repeat not-has-[[data-slot=empty-icon]]:before:content-['']",
className
)}
{...props}
/>
)
}
function EmptyHeader({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="empty-header"
className={cn(
"flex max-w-sm flex-col items-center gap-2 text-center",
className
)}
{...props}
/>
)
}
const emptyMediaVariants = cva(
"mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0",
{
variants: {
variant: {
default: "bg-transparent",
icon: "flex size-14 shrink-0 items-center justify-center rounded-2xl bg-(--nav-active-bg) text-primary [&_svg:not([class*='size-'])]:size-7",
},
},
defaultVariants: {
variant: "default",
},
}
)
function EmptyMedia({
className,
variant = "default",
...props
}: React.ComponentProps<"div"> & VariantProps<typeof emptyMediaVariants>) {
return (
<div
data-slot="empty-icon"
data-variant={variant}
className={cn(emptyMediaVariants({ variant, className }))}
{...props}
/>
)
}
function EmptyTitle({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="empty-title"
className={cn("text-lg font-bold tracking-tight", className)}
{...props}
/>
)
}
function EmptyDescription({ className, ...props }: React.ComponentProps<"p">) {
return (
<div
data-slot="empty-description"
className={cn(
"text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",
className
)}
{...props}
/>
)
}
function EmptyContent({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="empty-content"
className={cn(
"flex w-full max-w-sm min-w-0 flex-col items-center gap-4 text-sm text-balance",
className
)}
{...props}
/>
)
}
export {
Empty,
EmptyHeader,
EmptyTitle,
EmptyDescription,
EmptyContent,
EmptyMedia,
}Usage
import { Empty, EmptyHeader, EmptyTitle, EmptyDescription, EmptyContent, EmptyMedia } from "@/components/ui/empty"Examples
Icon
import { CalendarX } from "lucide-react"
import { Empty, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "@/registry/vcare/ui/empty"
export default function EmptyIcon() {
return (
<Empty>
<EmptyHeader>
<EmptyMedia variant="icon"><CalendarX /></EmptyMedia>
<EmptyTitle>No slots left</EmptyTitle>
<EmptyDescription>Try another day or another doctor.</EmptyDescription>
</EmptyHeader>
</Empty>
)
}Exports
Empty, EmptyHeader, EmptyTitle, EmptyDescription, EmptyContent, EmptyMedia
Dependencies
class-variance-authority@^0.7.1(npm)@vcare/art(registry)@vcare/utils(registry)
Raw item: /r/empty.json