Field
v0.8.1Label, control and one line for the hint or the error, with ids and aria wired up.
Field states
Install
npx shadcn add @syncrobotic/field Also installs: radix-ui, lucide-react, @syncrobotic/cn, @syncrobotic/label
Overview
A label, a control and one line below for the hint or the error, with ids and ARIA connected for you.
When to use
- Every form control that needs a label, help or validation.
- Errors that grow in below the control without moving the layout.
Use something else
- A group of checkboxes or radios under one question: a fieldset with a legend.
More examples
States and real uses. Each example is also a Storybook story and a visual regression test.
Field with select
Field with textarea
Usage rules
- The error replaces the hint in the same line, so the layout does not jump.
- Say how to fix it (“At least 8 characters”), not just that it is wrong.
Changelog
- 0.8.12026-11-21The last note is kept in state set during render instead of a ref written during render, so it is safe under the React Compiler. A fixed error still fades out while its line closes.
- 0.8.02026-11-17Shares its id, note and error through useField, so a Select's trigger inside a Field is labelled and described. A fixed error fades out while its line closes. Icon to label 8 px (gap-2), the same in every component.
- 0.7.02026-11-17The error appears with an icon in the hint's place. A control that brings its own id keeps it, and the label follows. The error icon is 16 px.