Field
As it appears on invoices.
npx shadcn add @klarhimmel/inputCopy for AIDetailsAbout, usage, props and more
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
We only use it to reply.
Import
Import
- 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
| Prop | Type | Default | Description |
|---|---|---|---|
label | ReactNode | required | Required. The visible label. |
labelHidden | boolean | - | The label is read by assistive tech but not drawn: for a field whose context already says what it is. |
hint | ReactNode | - | Help text under the control. |
error | ReactNode | - | Error text; replaces the hint and marks the control invalid. |
children | (p: { id: string; 'aria-describedby'?: string; 'aria-invalid'?: true }) =>… | required | Render prop: spread p onto the control. |
className | string | - | Extra classes, merged after the component's own. |
Accessibility
| Key | Does |
|---|---|
Tab | Moves to the control; the label is read with it |
Screen reader | Reads label, hint and error together |
Field wires the label, hint and error to the control with htmlFor and aria-describedby.
Accessibility