Toggle Sidebar B
AppearanceLight & dark mode 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.

Default

Single FormField bound through vee-validate.

Replay preview

Public display name.

Multiple fields

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

Replay preview

With validation

Per-field rules surface errors through FormMessage on submit.

Replay preview

Submit empty to see the error message.

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>

API Reference

Form

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

FormField

PropTypeDefaultDescription
namestringField name (path) in the form state.
rulesobject | functionPer-field validation.
SlotDescription
defaultScoped slot providing { componentField, errorMessage, value, handleChange }.

FormFieldArray

PropTypeDefaultDescription
namestringPath to an array field in the form state.
SlotDescription
defaultScoped slot providing { fields, push, remove, swap, ... } for repeatable rows.

FormItem

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

FormLabel

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

FormControl

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

FormDescription / FormMessage

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