Empty

@sushindustries/ui

Nothing, said properly: what is missing, why that is fine, and what to do next - in that order, quietly.

4 min read
View as MarkdownEdit on GitHub

Examples are the tab where the component is shown doing a job, not demonstrating a prop. The API tab already lists the props.

Viewport width
Phone22remthe floor, the narrowest this promises to work at
tanstacktanstack add https://adamjurek.com/r/tanstack/empty.jsonshadcnpnpm dlx shadcn@latest add https://adamjurek.com/r/shadcn/empty.json

Press Compare. The frames are real viewports, so a layout that breaks at 320 breaks here too rather than in somebody's hands.

In a page

import { Button, Empty } from "@sushindustries/ui";

export function SearchResults({ query, results }: {
	query: string;
	results: readonly { id: string; title: string }[];
}) {
	if (results.length === 0) {
		return (
			<Empty title={`Nothing for "${query}"`} icon="search">
				Try a shorter word, or check the spelling.
			</Empty>
		);
	}

	return (
		<ul className="flex col gap-2">
			{results.map((r) => (
				<li key={r.id}>{r.title}</li>
			))}
		</ul>
	);
}
tsx

What this example is not

Not a loading state. This only covers "the search finished and found nothing" - a request still in flight is SpinnerSpinnerOne ring, one border, one turn - with a visually hidden label, because a spinner with nothing to announce is just an animation.@sushindustries/ui · content's job, and conflating the two shows "nothing here" for a fraction of a second on every search.

UsesIconIconThe glyph set, generated from a Markdown table where every drawing carries its reason. One component, typed names, no icon font.@sushindustries/ui · content
Mentioned inData Table