Skip to content
Klarhimmel UI

Badge

New
npx shadcn add @klarhimmel/badge
DetailsAbout, usage, props and more

A short label for status or category.

When to use

  • Use for

    One or two words of status or category.

  • Not for

    Actions. A badge is never a button.

  • Pairs with

    Cards, table rows, headers.

Preview

NeutralAccentOutline
badge.tsx
import { Theme } from '@/components/klarhimmel/theme/style';
import { Badge } from '@/components/klarhimmel/ui/badge';

export default function Example() {
  return (
    <Theme theme="brand">
      <Badge tone="accent">New</Badge>
    </Theme>
  );
}

Import

Import

import { Badge } from '@/components/klarhimmel/ui/badge';
Files
badge.tsx, in components/klarhimmel/ui/. With it: theme, utils.
Render in
Render it inside <Theme>, once near the root of your app. Tokens and fonts are scoped to it, so outside it the component is unstyled.

Props

PropTypeDefaultDescription
tone'neutral' | 'accent' | 'outline' | 'warning' | 'danger''neutral'Visual weight; warning and danger for a priority, a near date, urgent.
childrenReactNoderequiredRequired. The label.
classNamestring-Extra classes, merged after the component's own.

Accessibility

KeyDoes
TabSkips it: a badge is text, not a control

Do not rely on the colour alone. The word carries the meaning.

Accessibility