Badge

@sushindustries/ui

A word wearing a fill, in the site's own tone pairs - a badge invents no colour of its own.

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/badge.jsonshadcnpnpm dlx shadcn@latest add https://adamjurek.com/r/shadcn/badge.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 { Badge, Card } from "@sushindustries/ui";

export function ComponentSummary({ name, tone }: { name: string; tone: string }) {
	return (
		<Card title={name}>
			<Badge tone={tone}>{tone}</Badge>
		</Card>
	);
}
tsx

What this example is not

tone is passed straight through from data here, not chosen for contrast against the card behind it - the badge always uses the same five tones regardless of what card or background it sits on, so there is no per-page palette decision to make.