<!-- Generated by scripts/gen-docs.mts from the JSDoc in registry/. Do not edit; run `pnpm run docs`. -->

# BuildChip

A compact, neutral chip for the title bar, like Xcode's scheme and activity area: it names the build the window runs ("Official 1.2.3", or "branch · sha" with "+ edits" for local changes not yet in any build), and opens a picker of the official build plus the builds serving now so a person can switch to the official build from the trigger. A `skew` line reads how far behind the current build is and offers its fix, in the same neutral tone as the rest of the chip, since running another build is routine, not an error.

## Install

Once per app, with Tailwind CSS v4 and an `@/*` path alias (skip `init` in an existing shadcn app), then the component:

```sh
npx shadcn@latest init --base base --preset nova --yes --no-monorepo
npx shadcn@latest add ourostack/ouro-ui/ouro-base#v1.3.823
npx shadcn@latest add ourostack/ouro-ui/build-chip#v1.3.823
```

More: [Installing](https://ui.ouroboros.bot/docs/installing.md).

```tsx
import { BuildChip } from "@/components/ouro/build-chip/build-chip";
```

## Example

```tsx
<BuildChip
  builds={[{ id: "official", label: "Official 1.2.3" }, { id: "w1", label: "feature/x · a1b2c3d", dirty: true }]}
  current="w1"
  skew={{ message: "2 commits behind main", fixLabel: "Update", onFix: rebase }}
  onSelect={switchTo}
/>
```

## Use instead when

- Use `Badge` instead for a status label with no picker, and `Menu` directly for an actions list that isn't a choice of running builds.

## Props

Type: `BuildChipProps`.

| Prop | Type | Description |
| --- | --- | --- |
| `builds` (required) | `readonly BuildChipBuild[]` | The picker's builds, official first: the official one and the builds serving now. |
| `className` | `string` | Layout only: margins, placement (`ms-auto`). Appearance classes warn in development. |
| `current` (required) | `string` | The id, from `builds`, of the build this window is running. |
| `labels` | `BuildChipLabels` | The words, for another language. |
| `onSelect` | `((id: string) => void)` | Called with a build's id when a person chooses it from the picker. |
| `ref` | `Ref<HTMLDivElement>` | Reaches the root. |
| `skew` | `BuildChipSkew` | How far behind the official build `current` is, with its fix. Omit it when `current` is the official build. |

## Don't use

These are not props. Passing one fails the type check with the fix in the error, and in development a console message names the fix.

- `options`: Not a prop. Ouro UI says `builds`: `<BuildChip builds={[...]} current="id">`.

## `className` is for layout only

Pass margins, width and grid placement (`mt-4`, `w-full`, `col-span-2`).

Appearance comes from props, not classes. In development, a class that sets appearance logs one warning per component instance, naming the prop to use instead. A class sets appearance when, after its variants (`hover:`, `sm:`) and any `!` are removed, it starts with `bg-`, `text-`, `border-`, `rounded-`, `shadow-`, `font-`, `ring-`, `from-`, `via-`, `to-`, `fill-` or `stroke-`, or is `border`, `rounded`, `shadow` or `ring`, or has a `dark:` variant. Text wrapping, overflow and table layout classes (`text-wrap`, `text-ellipsis`, `border-collapse`) are layout and do not warn.

Alignment classes (`text-center`) warn too: set alignment on a parent element.

## Types

### `BuildChipBuild`

One build in a `BuildChip`'s picker.

```ts
interface BuildChipBuild {
  /** Reported to `onSelect`, and matched against `current`. */
  id: string;
  /** What shows in the trigger and the picker: "Official 1.2.3", or "branch · sha". */
  label: string;
  /** Local edits since the build's own commit, not yet in any build. Adds "+ edits" after the label. @default false */
  dirty?: boolean | undefined;
}
```

### `BuildChipLabels`

The words `BuildChip` says, for apps in other languages.

```ts
interface BuildChipLabels {
  /** Names the picker for screen readers; a sighted person reads it as the trigger's own text. @default "Build" */
  group?: string | undefined;
  /** Appended to a dirty build's label. @default "+ edits" */
  dirty?: string | undefined;
}
```

### `BuildChipSkew`

How far the running build trails the official one, for `BuildChip`'s `skew` prop.

```ts
interface BuildChipSkew {
  /** What's out of step: "2 commits behind main". Shown above the fix, in the chip's neutral tone. */
  message: string;
  /** The fix's label: "Update". */
  fixLabel: string;
  /** Runs the fix a person chooses. The chip does not close itself; `onFix` does, by changing `current`. */
  onFix: (event: MouseEvent<HTMLElement>) => void;
}
```
