Toggle Sidebar B
header.lightDarkMode D

Form

vee-validate form primitives wrapped to match the design system. Use FormField + FormItem + FormControl + FormLabel + FormMessage to build accessible forms with built-in validation rendering.

When to use Form vs Field

Use Form (vee-validate) when you want a validation schema, async checks, and field-level error handling. Use the simpler Field primitive for layout-only wrappers without validation infrastructure.

Anatomy

Import all parts and piece them together.

vue
<script setup>
import {
  Form,
  FormControl,
  FormDescription,
  FormField,
  FormItem,
  FormLabel,
  FormMessage,
} from "@/components/ui/form";
</script>

<template>
  <Form>
    <FormField>
      <FormItem>
        <FormLabel />
        <FormControl />
        <FormDescription />
        <FormMessage />
      </FormItem>
    </FormField>
  </Form>
</template>

Default

Single FormField bound through vee-validate.

Public display name.

Multiple fields

Several FormFields stacked inside one Form, each with its own state.

With validation

Per-field rules surface errors through FormMessage on submit.

Submit empty to see the error message.

API Reference

Props, events, and slots for each sub-component.

Form

Props

PropTypeDefaultDescription
validation-schemaobjectvee-validate / zod / yup schema.
initialValuesobjectStarting form values.

FormField

Props

PropTypeDefaultDescription
namestringField name (path) in the form state.
rulesobject | functionPer-field validation.

Slots

SlotDescription
defaultScoped slot providing { componentField, errorMessage, value, handleChange }.

FormFieldArray

Props

PropTypeDefaultDescription
namestringPath to an array field in the form state.

Slots

SlotDescription
defaultScoped slot providing { fields, push, remove, swap, ... } for repeatable rows.

FormItem

Props

PropTypeDefaultDescription
classstringWraps one field; provides an id via context so Label and Control link up automatically.

FormLabel

Props

PropTypeDefaultDescription
classstringLabel bound to the FormItem control. Turns destructive when the field has an error.

FormControl

Slots

SlotDescription
defaultThe input element. FormControl wires its id, aria-describedby, and aria-invalid from the field state.

FormDescription / FormMessage

Props

PropTypeDefaultDescription
classstringDescription is helper text; FormMessage renders the current validation error for the field.