# Field

- **[Atoms](/components/)**

Label, control and a hint or error, with the ids wired for assistive tech.

## When to use

- **Use for**: Around every form control: it owns the label, the hint and the error.
- **Not for**: Grouping several controls. Use a fieldset.
- **Pairs with**: Input, Textarea, Switch.

## Preview

field.tsx

```
import { Theme } from '@/components/klarhimmel/theme/style';
import { Input, Field } from '@/components/klarhimmel/ui/input';

export default function Example() {
  return (
    <Theme theme="brand">
      <Field label="Company" error="Enter the company name.">
        {(p) => <Input {...p} />}
      </Field>
    </Theme>
  );
}
```

## Import

- **CLI**

  ```
  npx shadcn add @klarhimmel/input
  ```
- **Import**

  ```
  import { Field } from '@/components/klarhimmel/ui/input';
  ```

- **Files**: input.tsx, in components/klarhimmel/ui/. With it: button, editing, theme, utils.
- **Render in**: Render it inside <Theme>, once near the root of your app. Tokens and fonts are scoped to it, so outside it the component is unstyled.

## Props

- **label**: Required. The visible label.
- **labelHidden**: The label is read by assistive tech but not drawn: for a field whose context already says what it is.
- **hint**: Help text under the control.
- **error**: Error text; replaces the hint and marks the control invalid.
- **children**: Render prop: spread p onto the control.
- **className**: Extra classes, merged after the component's own.

## Accessibility

- Tab · Moves to the control; the label is read with it
- Screen reader · Reads label, hint and error together

[Accessibility](/get-started/accessibility)

Field wires the label, hint and error to the control with htmlFor and aria-describedby.

[Previous](/components/textarea)

[Next](/components/switch)
