Showcase

@sushindustries/ui

A component at every width it has to survive, with its source, install commands, and a live StackBlitz editor.

8 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/showcase.jsonshadcnpnpm dlx shadcn@latest add https://adamjurek.com/r/shadcn/showcase.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

This is the shape every component page on this site uses under its own ::start:showcase block - src is a per-component preview route, code is the string shown on the Code tab, and renderCode / renderStackblitz are supplied once by the app rather than by every call site.

import { Showcase } from "@sushindustries/ui";
import { highlight } from "~/modules/code/highlight";

export function ComponentPreview({ slug, source }: { slug: string; source: string }) {
	return (
		<Showcase
			src={`/preview/${slug}`}
			title={slug}
			code={source}
			renderCode={(code, language) => highlight(code, language)}
			height={380}
		/>
	);
}
tsx

What this example is not

renderCode and renderStackblitz are render props for a reason: this package ships no syntax highlighter and no StackBlitz SDK. A host that skips renderCode still gets a working Code tab - the fallback is a plain <pre>

  • and skipping renderStackblitz just drops that tab rather than breaking anything.
UsesIconIconThe glyph set, generated from a Markdown table where every drawing carries its reason. One component, typed names, no icon font.@sushindustries/ui · contentCopy ButtonCopy ButtonA glass chip that writes to the clipboard and confirms in the button itself, then hands back.@sushindustries/ui · contentDeviceDeviceA phone, a tablet or a laptop in CSS 3D, chosen by the stylesheet rather than by JavaScript, whose screen is a real scroll container with real controls in it.@sushindustries/ui · layoutuseDeviceKinduseDeviceKindWhich machine the stylesheet is currently drawing, as a value. Null until mounted, on purpose - a default would be a claim the server cannot support.@sushindustries/ui · layout