DefaultActivePendingFailed3 new
import { Badge } from "@replicas/ui";

export default function BadgeDemo() {
  return (
    <>
      <Badge>Default</Badge>
      <Badge variant="success" dot>
        Active
      </Badge>
      <Badge variant="warning">Pending</Badge>
      <Badge variant="error">Failed</Badge>
      <Badge variant="info">3 new</Badge>
    </>
  );
}

Examples

Variants

DefaultBlueGreenYellowRed
<Badge variant="default">Default</Badge>
<Badge variant="blue">Blue</Badge>
<Badge variant="green">Green</Badge>
<Badge variant="yellow">Yellow</Badge>
<Badge variant="red">Red</Badge>

With Dot

Online
function WithDot() {
  return (
    <Badge variant="success" dot>
      Online
    </Badge>
  );
}

Count

12
function Count() {
  return <Badge variant="info">12</Badge>;
}

Prompt

Copy Prompt hands your agent everything it needs to build the Badge in the Notion style: the measured tokens, the CSS and the structure.

Show Prompt
# Notion Badge

A small status label for counts, states and categories.

Build a Badge in this project that looks and behaves like Notion's. Measured from the running Notion app (notion.com). Keep every value exact. Map the tokens onto the project's own theme variables instead of hard-coding them. Use the project's own component library for behaviour, or Base UI primitives if it has none.

Fidelity: Measured from the Beta badge in Settings > Preferences and the Recommended badge in Settings > Profile. Green, yellow and red use Notion's palette tokens on the same shape.

## Variants

- `variant`: `default`, `blue`, `green`, `yellow`, `red`

## Tokens

| Token | Light | Dark |
| --- | --- | --- |
| `--c-bluTexAccPri` | `#2783de` | `#2783de` |
| `--ca-bluBacSecTra` | `#007cd718` | `#439bff3d` |
| `--c-redTexAccPri` | `#e56458` | `#e56458` |
| `--ca-redBacSecTra` | `#df160018` | `#ff685c3d` |
| `--c-greTexSec` | `#50946e` | `#50946e` |
| `--ca-greBacSecTra` | `#00642d17` | `#6cffac28` |
| `--c-yelTexSec` | `#cb9434` | `#cb9434` |
| `--ca-yelBacSecTra` | `#d3a80023` | `#ffcd4b3d` |
| `--c-betBac` | `#2a1c0012` | `#ffffeb1a` |
| `--c-betTex` | `#8e8b86` | `#8e8b86` |
| `--font-size-micro` | `11px` | `11px` |
| `--font-weight-medium` | `500` | `500` |
| `--radius-tag` | `4px` | `4px` |

## CSS

Scoped under `[data-style="notion"]`; dark rules sit under `[data-theme="dark"]`. The `ui-*` classes and data attributes match the structure below.

```css
[data-style="notion"] {
  .ui-badge {
    --badge-bg: var(--c-betBac);
    --badge-text: var(--c-betTex);

    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 4px;
    border-radius: var(--radius-tag);
    background-color: var(--badge-bg);
    color: var(--badge-text);
    font-family: inherit;
    font-size: var(--font-size-micro);
    font-weight: var(--font-weight-medium);
    line-height: 1.3;
    white-space: nowrap;
  }

  .ui-badge:is([data-variant="blue"], [data-variant="info"]) {
    --badge-bg: var(--ca-bluBacSecTra);
    --badge-text: var(--c-bluTexAccPri);
  }

  .ui-badge:is([data-variant="green"], [data-variant="success"]) {
    --badge-bg: var(--ca-greBacSecTra);
    --badge-text: var(--c-greTexSec);
  }

  .ui-badge:is([data-variant="yellow"], [data-variant="warning"]) {
    --badge-bg: var(--ca-yelBacSecTra);
    --badge-text: var(--c-yelTexSec);
  }

  .ui-badge:is([data-variant="red"], [data-variant="error"]) {
    --badge-bg: var(--ca-redBacSecTra);
    --badge-text: var(--c-redTexAccPri);
  }

  .ui-badge-dot {
    width: 6px;
    height: 6px;
    flex-shrink: 0;
    border-radius: 100%;
    background-color: currentColor;
  }
}
```

## Structure

How Replicas assembles it on Base UI.

```tsx
import type { ComponentProps } from "react";
import { join } from "./utils";

export type BadgeProps = ComponentProps<"span"> & {
  variant?: string;
  size?: string;
  dot?: boolean;
};

export function Badge({ className, variant = "default", size = "medium", dot = false, children, ...props }: BadgeProps) {
  return (
    <span className={join("ui-badge", className)} data-variant={variant} data-size={size} {...props}>
      {dot ? <span className="ui-badge-dot" aria-hidden /> : null}
      {children}
    </span>
  );
}
```

## Example

```tsx
import { Badge } from "@replicas/ui";

export default function BadgeDemo() {
  return (
    <>
      <Badge>Default</Badge>
      <Badge variant="success" dot>
        Active
      </Badge>
      <Badge variant="warning">Pending</Badge>
      <Badge variant="error">Failed</Badge>
      <Badge variant="info">3 new</Badge>
    </>
  );
}
```

## Foundations

The rest of the Notion style, as a skill: https://replicas.raphaelsalaja.com/skills/notion/SKILL.md