On this page

Form

When to use Form instead of Field, validation timing, error messages and buttons.

Draft. Ported from the shadcn-vue Form (registry, read 12 November 2026) and restyled with Beehexa tokens. Not yet approved.

Form connects vee-validate to the Beehexa fields. Each FormItem has the same layout as Field: label above, help text and error under the control, 8 px apart.

When to use

  • When a form checks its values before sending them, with rules written once in a schema (zod).
  • When you want ids, aria-describedby and aria-invalid set for you.

When not to use

  • For one setting that applies at once, such as a switch. It needs no submit.
  • For a form with no rules to check. Field is enough.

Placement and spacing

The same as Field: label (font.label.default, color.text), control, help text (font.body.small, color.text.subtle), error (font.body.small, color.text.danger), space.100 apart. Fields sit space.stack apart. The label stays color.text when there is an error.

Validation

  • Check a field when people leave it, and the whole form when they submit. Don’t show an error while people type their first characters.
  • On submit, show every error and move focus to the first field with one.
  • Write each message to say what is wrong and how to fix it: “Enter an email address like [email protected].”, not “Invalid”.
  • Mark the few optional fields with “(optional)” in the label, rather than an asterisk on every required one.

Buttons

  • On a page, the buttons sit under the form, left-aligned, primary first (D10).
  • In a dialog, they sit at the bottom right, primary last, Cancel before it (D10).
  • Keep the submit button enabled. Pressing it shows what is missing; a disabled button does not say why.

Parts

FormField (vee-validate Field), FormItem, FormLabel, FormControl, FormDescription, FormMessage, plus Form and FormFieldArray from vee-validate.