For the complete documentation index, see llms.txt. Markdown variants are available by appending .md to any URL or sending an Accept: text/markdown header. An agent skill is available at /.well-known/agent-skills/site-skill.md.
FrakmentFrakment

Empty

A centered placeholder for empty states.

No projects yet
Get started by creating your first project.
empty.tsx
import { cva, type VariantProps } from "class-variance-authority";
import { cn } from "@/lib/utils";

function Empty({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      className={cn(
        "flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-xl border-dashed p-6 text-center text-balance",
        className
      )}
      data-slot="empty"
      {...props}
    />
  );
}

function EmptyHeader({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      className={cn("flex max-w-sm flex-col items-center gap-2", className)}
      data-slot="empty-header"
      {...props}
    />
  );
}

const emptyMediaVariants = cva(
  "mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0",
  {
    defaultVariants: {
      variant: "default",
    },
    variants: {
      variant: {
        default: "bg-transparent",
        icon: "bg-muted text-foreground flex size-8 shrink-0 items-center justify-center rounded-lg [&_svg:not([class*='size-'])]:size-4",
      },
    },
  }
);

function EmptyMedia({
  className,
  variant = "default",
  ...props
}: React.ComponentProps<"div"> & VariantProps<typeof emptyMediaVariants>) {
  return (
    <div
      className={cn(emptyMediaVariants({ className, variant }))}
      data-slot="empty-icon"
      data-variant={variant}
      {...props}
    />
  );
}

function EmptyTitle({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      className={cn("text-sm font-medium tracking-tight", className)}
      data-slot="empty-title"
      {...props}
    />
  );
}

function EmptyDescription({ className, ...props }: React.ComponentProps<"p">) {
  return (
    <div
      className={cn(
        "text-muted-foreground [&>a:hover]:text-primary text-sm/relaxed [&>a]:underline [&>a]:underline-offset-4",
        className
      )}
      data-slot="empty-description"
      {...props}
    />
  );
}

function EmptyContent({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      className={cn(
        "flex w-full max-w-sm min-w-0 flex-col items-center gap-2.5 text-sm text-balance",
        className
      )}
      data-slot="empty-content"
      {...props}
    />
  );
}

export {
  Empty,
  EmptyContent,
  EmptyDescription,
  EmptyHeader,
  EmptyMedia,
  EmptyTitle,
};

Empty is a composable placeholder for zero-data screens — inbox, search results, project lists, first-run onboarding. It renders a dashed surface with a stacked icon, title, description, and optional call-to-action.

Installation

Composition

Empty
├── EmptyHeader
├── EmptyMedia
├── EmptyTitle
├── EmptyDescription
└── EmptyContent

Examples

Without media

Omit EmptyMedia entirely for the simplest empty state.

No results found
Try adjusting your search or filters.
empty-no-media.tsx
"use client";

import {
  Empty,
  EmptyDescription,
  EmptyHeader,
  EmptyTitle,
} from "@/components/ui/empty";

export function EmptyNoMedia() {
  return (
    <Empty className="max-w-sm border">
      <EmptyHeader>
        <EmptyTitle>No results found</EmptyTitle>
        <EmptyDescription>
          Try adjusting your search or filters.
        </EmptyDescription>
      </EmptyHeader>
    </Empty>
  );
}
tsx
<Empty>
  <EmptyHeader>
    <EmptyTitle>No results found</EmptyTitle>
    <EmptyDescription>Try adjusting your search or filters.</EmptyDescription>
  </EmptyHeader>
</Empty>

EmptyDescription accepts inline links that pick up Frakment underline styling.

No projects yet
Read the guide to learn how to create one.
empty-link.tsx
"use client";

import { Folder } from "lucide-react";
import {
  Empty,
  EmptyDescription,
  EmptyHeader,
  EmptyMedia,
  EmptyTitle,
} from "@/components/ui/empty";

export function EmptyLink() {
  return (
    <Empty className="max-w-sm border">
      <EmptyHeader>
        <EmptyMedia variant="icon">
          <Folder />
        </EmptyMedia>
        <EmptyTitle>No projects yet</EmptyTitle>
        <EmptyDescription>
          <a href="#docs">Read the guide</a> to learn how to create one.
        </EmptyDescription>
      </EmptyHeader>
    </Empty>
  );
}
tsx
<Empty>
  <EmptyHeader>
    <EmptyMedia variant="icon">
      <Folder />
    </EmptyMedia>
    <EmptyTitle>No projects yet</EmptyTitle>
    <EmptyDescription>
      <a href="#docs">Read the guide</a> to learn how to create one.
    </EmptyDescription>
  </EmptyHeader>
</Empty>

Outline media

Use variant="default" on EmptyMedia to render media without a muted background square.

Nothing here
Use variant="default" to render media without a background.
empty-outline.tsx
"use client";

import { Folder } from "lucide-react";
import {
  Empty,
  EmptyDescription,
  EmptyHeader,
  EmptyMedia,
  EmptyTitle,
} from "@/components/ui/empty";

export function EmptyOutline() {
  return (
    <Empty className="max-w-sm border">
      <EmptyHeader>
        <EmptyMedia>
          <Folder />
        </EmptyMedia>
        <EmptyTitle>Nothing here</EmptyTitle>
        <EmptyDescription>
          Use variant="default" to render media without a background.
        </EmptyDescription>
      </EmptyHeader>
    </Empty>
  );
}
tsx
<Empty>
  <EmptyHeader>
    <EmptyMedia>
      <Folder />
    </EmptyMedia>
    <EmptyTitle>Nothing here</EmptyTitle>
    <EmptyDescription>
      Use variant="default" to render media without a background.
    </EmptyDescription>
  </EmptyHeader>
</Empty>

In Context

Zero-data state

No messages
Start a new conversation to see it here.
empty-zero-data.tsx
"use client";

import { MessageCircleDashedIcon } from "lucide-react";
import {
  Empty,
  EmptyDescription,
  EmptyHeader,
  EmptyMedia,
  EmptyTitle,
} from "@/components/ui/empty";

export function EmptyZeroData() {
  return (
    <Empty className="mx-auto h-64 w-full max-w-sm">
      <EmptyHeader>
        <EmptyMedia>
          <MessageCircleDashedIcon />
        </EmptyMedia>
        <EmptyTitle>No messages</EmptyTitle>
        <EmptyDescription>
          Start a new conversation to see it here.
        </EmptyDescription>
      </EmptyHeader>
    </Empty>
  );
}

API Reference

All parts extend React.ComponentProps<"div"> (except EmptyDescription which renders a <div> too for layout consistency).

EmptyMedia

PropTypeDefaultDescription
variant
"default""icon"
—Icon wraps the child in a rounded muted square; default is transparent.

Usage

empty.tsx
import { Empty, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "@/components/ui/empty";
<DocsBaseSwitcher base="web" component="empty" className="mb-6" />
empty.tsx
<Empty>
  <EmptyHeader>
    <EmptyMedia><MessageCircleDashedIcon /></EmptyMedia>
    <EmptyTitle>No messages yet</EmptyTitle>
    <EmptyDescription>Send the first one.</EmptyDescription>
  </EmptyHeader>
</Empty>

Accessibility

  • The EmptyTitle renders as a heading; document outline stays flat.
  • Pair the icon with the title; icon-only empty states are invisible to screen readers.
  • Provide a primary action inside the empty state when possible.

Best Practices

  • Explain the empty state. "No messages" beats "Empty".
  • Offer the first action. A button or link beats a dead end.
  • Keep it small. Empty states should not fill the whole page unless the page is empty.
  • Do not hide the empty state during loading. Use a Skeleton instead.