# Badge

Compact semantic status seam for tags, counts, and entity state labels.

[All components](https://rickylabs.github.io/netscript/design-system/components/) · [Theme builder](https://rickylabs.github.io/netscript/create/) · [Implementation source](https://github.com/rickylabs/netscript/blob/main/packages/fresh-ui/registry/components/ui/badge.tsx)

## Live preview

[Open live badge preview](https://rickylabs.github.io/netscript/assets/fresh-ui/preview/?component=badge&theme=studio-utility)

## Install

```bash
netscript ui:add badge
```

## Usage and examples

The preview runs this JSX with the installed components. Import any composed primitives from your UI directory.

```tsx
import { useState } from 'preact/hooks';
import { Badge } from '@app/components/ui/badge.tsx';

export function Example() {
  const [value, setValue] = useState('standard');
  const [open, setOpen] = useState(false);
  const [notice, report] = useState('');
  return (<><div><div class="demo-row"><Badge variant="success">Paid</Badge><Badge variant="warning">Awaiting payment</Badge><Badge variant="muted">Refunded</Badge></div></div><p role="status">{notice}</p></>);
}
```

## Props

Generated from native `deno doc --json --private` over the shipped implementation. Compound component props retain their owning interface; native attributes pass through where declared.

| Owner | Prop | Type | Optional | Description |
| --- | --- | --- | --- | --- |
| `BadgeProps` | `children` | `Renderable` | No |  |
| `BadgeProps` | `class` | `string` | Yes |  |
| `BadgeProps` | `variant` | `BadgeVariant` | Yes |  |

```typescript
type BadgeVariant = "primary" | "secondary" | "info" | "success" | "warning" | "destructive" | "muted"
BadgeProps extends Omit<JSX.HTMLAttributes<HTMLSpanElement>, "class" | "children">
```

## Keyboard

Presentation component; no component-specific keyboard interactions.

## Tokens

Semantic contract roles: `border/default`, `border/width`, `radius/badge`, `space/badge/height`, `space/badge/padding-x`, `surface/inverse`, `surface/muted`, `text/fg`, `text/inverse`, `text/muted`.

CSS custom properties referenced directly: `--ns-badge-height`, `--ns-badge-padding-x`, `--ns-border`, `--ns-border-width`, `--ns-destructive-border`, `--ns-destructive-subtle`, `--ns-destructive-text`, `--ns-font-label`, `--ns-font-mono`, `--ns-info-border`, `--ns-info-subtle`, `--ns-info-text`, `--ns-leading-label`, `--ns-muted`, `--ns-muted-fg`, `--ns-primary`, `--ns-primary-border`, `--ns-primary-subtle`, `--ns-primary-text`, `--ns-radius-badge`, `--ns-radius-full`, `--ns-radius-sm`, `--ns-secondary`, `--ns-secondary-border`, `--ns-secondary-subtle`, `--ns-secondary-text`, `--ns-space-0-5`, `--ns-space-1`, `--ns-space-1-5`, `--ns-space-2`, `--ns-success`, `--ns-success-border`, `--ns-success-subtle`, `--ns-success-text`, `--ns-text-label`, `--ns-tracking-label`, `--ns-warning`, `--ns-warning-border`, `--ns-warning-subtle`, `--ns-warning-text`, `--ns-weight-label`.

## Contract and compatibility

Accessibility pattern: noninteractive presentation

- Native DOM attributes pass through where the implementation accepts them.

Design contract values marked planned are not implementation props. The props above describe what ships today.
