Skip to content
Design System
GitHub

A form to copy and change: React Hook Form's Controller around the kit's Field, a zod schema, focus on the first error, server errors on a field or the form, a submit button that waits. No form wrapper component.

Shown in the schedule and on the island.

Repeat

Optional. Operators see this before the mission starts.

Form create

Install
npx shadcn add @syncrobotic/form

Also installs: react-hook-form, @hookform/resolvers@^7, zod@^3.25, lucide-react, @syncrobotic/cn, @syncrobotic/alert, @syncrobotic/button, @syncrobotic/choice-field, @syncrobotic/field, @syncrobotic/input, @syncrobotic/radio-group, @syncrobotic/select, @syncrobotic/textarea

Overview

How to build a form with React Hook Form and the kit's Field, and an example to install and change. There is no form component: each control sits in a Controller and a Field, the way shadcn does it, so the kit itself depends on no form library.

When to use

  • Create and edit forms: a mission, a robot, a site, an account.
  • Any form validated by a schema (zod, valibot) through a resolver.

Use something else

  • Filters above a list, which apply as you choose: Filter form.
  • One field on its own with no submit (a search box): Search field.

More examples

States and real uses. Each example is also a Storybook story and a visual regression test.

Try “Patrol dog 2B10” for a name that is taken.

Form server errors

Tell me about stops and faults
Quiet hours

Form choices

Metres per second, 0.2 to 1.5.

Form edit

Usage rules

  • No wrapper: each control goes in React Hook Form's Controller and the kit's Field (FieldSet for a group). Field wires the label, hint, error, aria-invalid and aria-describedby.
  • Errors wait for the first submit, then follow each change (React Hook Form's default mode). Never tell someone off while they type a first answer.
  • Give field.ref to something focusable, so a failed submit focuses the first field in error: {...field} on an Input, ref on a Select's trigger, ref on a group's first choice.
  • A refusal about one field (a name already taken) goes on that field with setError; one about the whole save goes in an Alert above the fields (setError("root.server", …)). Never in a toast.
  • Await the save in onSubmit and pass formState.isSubmitting to the button's loading. Name the result (“Create mission”), not “Submit”. Write the messages in the schema, in the page's language.

Changelog

  • 0.25.02026-11-21Asks for @hookform/resolvers 7 (it named no range, so a new install already got 7): run npm i @hookform/resolvers@^7 and keep your copy as it is; behaviour and messages are unchanged. zod stays ^3.25; a project on zod 4 keeps it, since zodResolver takes either with no import change.
  • 0.20.12026-11-21No unused React import, so the file compiles in projects with noUnusedLocals.
  • 0.20.02026-11-20First release: an example to install and change (MissionForm), React Hook Form's Controller around Field, as shadcn does. No wrapper component.

How to upgrade