# CountBadge

A compact count with an optional cap or unread dot.

Connect Flood once using [the installation guide](https://flood.md/docs/installation). Then import the components you use; no per-component add command is needed.

## Example

```tsx
"use client";

import { FloodRoot, CountBadge, Inline, Text } from "@flood-md/react";
import "@flood-md/react/styles.css";

export function Example() {
  return (
    <FloodRoot>
      <Inline gap="2"><Text size="compact">Inbox</Text><CountBadge count={137} formatLabel={count => `${count} unread messages`} /></Inline>
    </FloodRoot>
  );
}
```

## Design notes

- Use CountBadge for a passive count beside the destination or label it qualifies. It adds no focus stop. Use formatLabel for a localized accessible description.
- The default visual cap is 99. Counts above max display the cap with a plus sign while assistive technology receives the exact count. Use locale to format the digits.
- Zero is hidden by default. Set showZero when an explicit zero is useful. Dot presentation signals a nonzero count in tight spaces and always hides zero.
- Use NavigationItem compactBadge to put an unread dot on a compact navigation control without moving its icon.

## API reference

| Prop | Values | Default |
| --- | --- | --- |
| `size` | `"sm" \| "md" \| "lg"` | `"sm"` |
| `tone` | `"neutral" \| "accent" \| "error" \| "warning" \| "success" \| "info"` | `—` |
| `variant` | `"subtle" \| "outline"` | `—` |
| `count` | `number` | `Required` |
| `max` | `number` | `99` |
| `showZero` | `boolean` | `false` |
| `presentation` | `"count" \| "dot"` | `"count"` |
| `locale` | `string` | `—` |
| `formatLabel` | `(count: number) => string` | `—` |
| `Native HTML props` | `Omit<HTMLAttributes<HTMLSpanElement>, "children">` | `Forwarded` |
