DocsComponentsTemplatesThemesGitHub

CountBadge

Red numeric badge for unread counts.

Code

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

export default function Demo() {
  return (
    <div
      style={{
        display: 'flex',
        gap: 8,
      }}
    >
      <CountBadge count={3} />
      <CountBadge count={120} />
    </div>
  );
}

Install

From npm:

npm install @fruit-labs/design

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

Or copy the TypeScript source into your project:

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

Guidelines

  • Caps at max (99+). Give it a label like "3 unread".

Props

PropTypeRequired
countnumberYes
maxnumberNo
labelstringNo
classNamestringNo

Edit this example on GitHub