# Label

The name of a control. Point it at the control with `htmlFor` and the control's `id`, or wrap both in it. Clicking it focuses or toggles the control. It dims with the control beside it (a `peer`) when that control is disabled or locked, so keep it directly after the control in the markup, or set `data-disabled` on a wrapping `group`.

- Registry name: `label` (`@candor/label`)
- Tier: Free (MIT). No licence key needed.
- Docs: https://candor.themethodic.com/docs/label

## Install

```bash
npx candor-ui add label
```

Run `npx candor-ui@latest init` once first (https://candor.themethodic.com/get-started.md). Without the CLI: `npx shadcn@latest add @candor/label`.
It brings in: tokens, utils.
npm packages: @base-ui/react@^1.9.0.

## Example

```tsx
"use client"

import { Label } from "@/components/candor/ui/label"
import { Input } from "@/components/candor/ui/input"

export default function Example() {
  return (
    <div className="flex w-full max-w-sm flex-col gap-2">
      <Label htmlFor="agent-name">Agent name</Label>
      <Input id="agent-name" placeholder="Billing assistant" />
    </div>
  )
}
```

## <Label>

Props:

- `render?: useRender.RenderProp | undefined`: Draws this element instead of a <label>, with the label's styles: `render={<span />}` for a caption that names a group.

Also takes the props of `React.ComponentProps<"label">`.

## Rules for using Candor UI

- Components take plain typed data. Never pass model output as HTML or render it as a link; messages are typed blocks.
- A control that can't be used says why: wrap it in `<Locked reason="…">`, don't just disable it.
- Don't show a value you don't have: leave it out (it renders as —) rather than guess. An estimate is labelled as one.
- Nothing is pre-selected in a decision a person makes, and the agent is named from your app's data, never from model output.
- Your app's words go in `LocaleProvider`: its fixed strings in `strings`, its nouns in `nouns`; entity kinds and agent roles in `EntityKindsProvider` and `AgentRolesProvider`.
