implement
Empty

Empty

The state a list is in before it has anything in it.

No projects yet
Projects group your deployments, domains, and environment variables.
import { PlusIcon, InboxIcon } from "@implementjs/lucide";
import { Button } from "@/lib/components/ui/button";
import {
	Empty,
	EmptyContent,
	EmptyDescription,
	EmptyHeader,
	EmptyMedia,
	EmptyTitle,
} from "@/lib/components/ui/empty";

export default function EmptyDemo() {
	return Empty(
		{ class: "w-full max-w-md border" },
		EmptyHeader(
			EmptyMedia({ variant: "icon" }, InboxIcon({ "aria-hidden": true })),
			EmptyTitle("No projects yet"),
			EmptyDescription("Projects group your deployments, domains, and environment variables."),
		),
		EmptyContent(Button({ size: "sm" }, PlusIcon({ "aria-hidden": true }), "New project")),
	);
}

Installation

npx jsrepo add @implementjs/ui/empty

It installs tailwind-variants at the same time.

Usage

An empty state that says what the thing is and offers the first step is worth more than a blank panel. That is all this arranges.

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

Empty(
	EmptyHeader(
		EmptyMedia({ variant: "icon" }, InboxIcon({ "aria-hidden": true })),
		EmptyTitle("No projects yet"),
		EmptyDescription("Projects group your deployments and domains."),
	),
	EmptyContent(Button({ size: "sm" }, "New project")),
);

The border is opt-in

The root sets border-dashed but no border, so by default it is a spacing container with no outline. Add border when the empty state should read as a panel:

Empty({ class: "border" } /* ... */);

Media

EmptyMedia is plain by default and gives a filled, rounded tile under variant: "icon" — the difference between an illustration and a glyph.

API Reference

Empty

The state a list is in before it has anything in it: centered, dashed, and roomy. Renders a Div; extra props are forwarded onto it.

EmptyHeader

Media, title, and description as one centered stack. Renders a Div; extra props are forwarded onto it.

EmptyMedia

The icon or illustration above the title. Renders a Div; extra props are forwarded onto it.

PropTypeDefaultDescription
variant"default" | "icon""default"icon puts the glyph in a filled, rounded tile.

EmptyTitle

What is missing. Renders a Div; extra props are forwarded onto it.

EmptyDescription

Why it is worth having, in a line. Renders a Div; extra props are forwarded onto it.

EmptyContent

Whatever comes after the message — a button, a form, a hint. Renders a Div; extra props are forwarded onto it.