# Badge

Supply UI 1.1.0. Showing things.

A status word. `tone`: `neutral`, `primary`, `success`, `warning`, `danger`, `info`, `outline`

A status word on a thing: "Paid", "Draft", "Overdue"

## Options

| Option | Type | Default | What it does |
| --- | --- | --- | --- |
| `dot` | `boolean` |  | A small dot in the badge's colour before the word. |
| `pill` | `boolean` |  | Fully round ends, whatever the theme's corners. |
| `tone` | `"primary" \| "outline" \| "danger" \| "neutral" \| "success" \| "warning" \| "info"` | `'neutral'` | Its colour: `neutral` (default), `primary`, `success`, `warning`, `danger`, `info` or `outline`. |

It also takes the 280 attributes of the element or UI SDK part it renders (`className`, `aria-label`, events…).

## Without React

Classes: `ui-badge ui-badge--success`

## CSS parts

With the CSS in parts (`/ui/css/`), it needs: `components/badge.css`, besides the ones every page loads.

## In the examples

- Still up: Two weeks of checks, the dips hatched (https://www.supply.family/ui/#scene-uptime)
- Details from below: An order rises as a drawer you can drag (https://www.supply.family/ui/#scene-orders)
- More on right-click: The actions of a row, where the hand already is (https://www.supply.family/ui/#scene-right-click)
- Loading, politely: Grey shapes hold the place until the classes arrive (https://www.supply.family/ui/#scene-loading)
- Sign it once sure: Every step lands on the timeline. Signing asks twice. (https://www.supply.family/ui/#scene-contract)
- Set up, one step at a time: Open a step, mark it done, watch the bar (https://www.supply.family/ui/#scene-setup)
- Who still owes: Nudge a client and the row remembers (https://www.supply.family/ui/#scene-owing)
- An invoice that adds up: Change a quantity or a price; the lines and VAT follow (https://www.supply.family/ui/#scene-invoice-lines)
- A licence for the team: Pick the use and the people; five or more pay less (https://www.supply.family/ui/#scene-font-licence)
- Codes that check themselves: Type a code and the total answers (https://www.supply.family/ui/#scene-coupon)
- Jump anywhere with ⌘K: Pages and actions in one search (https://www.supply.family/ui/#scene-jump)
- File, View, the old way: Menus of an application, ticks and choices included (https://www.supply.family/ui/#scene-editor-menus)
- Write, and see it sent: Type on the left; drag the line to make room (https://www.supply.family/ui/#scene-newsletter)
- Room by room: Swipe through the finished rooms, or use the arrows (https://www.supply.family/ui/#scene-rooms)
- When the box comes: Type or pick the day, then the part of it (https://www.supply.family/ui/#scene-delivery)
- Who is next: Drag a walk-in up the queue; the waits follow (https://www.supply.family/ui/#scene-queue)
- Share with a link: A popover with the switch and the link to copy (https://www.supply.family/ui/#scene-share)

## Showing things: notes

**States.** Lists, tables and boards have three more states besides their content: empty (`Empty`, with the first action inside), loading (`Skeleton`) and failed (`Alert tone="danger"`). A chosen row shows in ink, never in the brand colour.

**Do**
- Put numbers, dates and codes in `ui-mono` (in a table cell, `ui-num`, which also aligns them).
- Let a `Table` turn into blocks on a phone; give it `scroll` only when it is read down its columns.
- Show a status in words and colour together (`Badge tone="success"` with "Paid"), never colour alone.

**Don't**
- Don't put a card round a `Table`, `List`, `Cells`, `Calendar` or `Empty`: they draw their own box.
- Don't truncate a name or a price to fit; let it wrap. Truncate only file names and addresses.
- Don't use the status colours (success, warning, danger, info) for anything but those meanings.
