DocsComponentsTemplatesThemesGitHub

Badge

Small status label; tone pairs color with a word.

Code

import * as React from 'react';
import { Badge, CountBadge } from '@fruit-labs/design';

export default function Demo() {
  return (
    <div
      style={{
        display: 'flex',
        gap: 8,
        flexWrap: 'wrap',
      }}
    >
      <Badge tone="accent">New</Badge>
      <Badge tone="success" dot>
        Active
      </Badge>
      <Badge tone="warning" dot>
        Review
      </Badge>
      <Badge tone="danger" dot>
        Blocked
      </Badge>
      <Badge>Draft</Badge>
      <CountBadge count={3} label="3 unread" />
    </div>
  );
}

Order states

import { Badge } from '@fruit-labs/design';

export default function Example() {
  return (
    <div style={{ display: 'flex', flexWrap: 'wrap', gap: 12, alignItems: 'center' }}>
      <Badge tone="success" dot>Paid</Badge>
      <Badge tone="warning" dot>Pending</Badge>
      <Badge tone="danger" dot>Refunded</Badge>
      <Badge tone="accent">New</Badge>
    </div>
  );
}

Install

From npm:

npm install @fruit-labs/design

import { Badge } from '@fruit-labs/design';

Or copy the TypeScript source into your project:

npx shadcn@latest add https://design.fruitlabs.online/r/badge.json

Guidelines

  • Status must be readable without color: always write the status word.
  • dot adds a leading dot for list/table statuses.

Props

PropTypeRequired
tone'neutral' | 'accent' | 'success' | 'warning' | 'danger'No
dotbooleanNo
classNamestringNo
childrenReact.ReactNodeNo

Edit this example on GitHub