shadcn Forms And Field Primitives
Pack:
shadcnSource:shadcn/shadcn-forms-and-field-primitives/SKILL.mdUse this skill when the task is about form UI structure, not when it is purely about a form-state library in isolation.
- field primitives and form presentation
- choosing a form-state strategy
- keeping validation and UI responsibilities separate
- integrating shadcn fields with
react-hook-formor another chosen form-state layer - deciding when the problem is really form-state orchestration rather than field presentation
Routing cues
Section titled “Routing cues”- shadcn forms, field primitives,
react-hook-form,Controller,Field, form layout, input validation presentation, error text, helper text, or deciding how to structure a product form -> use this skill - if the task is mainly about complex form-state orchestration, async field reactivity, or large dynamic field arrays, solve that in the chosen form-state layer instead of forcing the visual field layer to own it
Default path
Section titled “Default path”- Pick one form-state strategy per app or feature and stay consistent.
- Use shadcn field primitives for structure, labels, descriptions, and errors.
- Keep validation logic in the schema or form-state layer, not buried inside visual components.
- Keep submission side effects at the mutation or action boundary, not inside field wrappers.
- Keep the field layer focused on structure and presentation when the problem becomes mostly about form-state orchestration.
When to deviate
Section titled “When to deviate”- Use
react-hook-formwhen the app already standardizes on it and the flow is straightforward. - Use a richer form-state layer only when the app actually needs stronger reactive state, richer async handling, or large dynamic form behavior.
- Build field-specific wrappers only when the same structure and validation presentation repeat across the product.
Guardrails
Section titled “Guardrails”- one form-state strategy per surface is better than mixing libraries casually
- field components should present state, not own business logic
- server validation still matters even when client validation is rich
- form wrappers should reduce duplication, not obscure the underlying state model
- mixing several form-state approaches inside one feature without a clear reason
- hiding business logic in
Input,Select, or field wrapper components - copying long docs examples without reducing them to the app’s actual form contract
- turning the visual field layer into the source of truth for validation
Verification checklist
Section titled “Verification checklist”- the form uses one clear state-management strategy
- visual field primitives and validation logic stay in separate layers
- repeated field wrappers exist only when they remove real duplication
- complex form-state behavior stays in the chosen form-state layer instead of being improvised in the visual field layer
- server-side validation or mutation handling is still part of the final design
Current snapshot
Section titled “Current snapshot”- Checked against official docs on 2026-04-03
- Current npm lines verified live on 2026-04-03:
shadcn@4.1.2,react-hook-form@7.72.1 - Docs in scope: shadcn forms guidance with
react-hook-formand general field ownership patterns