Skip to content

React Hook Form bindings (Form, FormField, FormItem, FormLabel, FormControl, FormMessage) that wire validation state into Mac OS X Aqua labels, invalid control edges and 11px red error messages.

Installation

Requires the theme. Register the @skeuomorph namespace and add @skeuomorph/skeuomorph first, as shown in the installation guide. The CLI also pulls it in as a dependency.

pnpm dlx shadcn@latest add @skeuomorph/form

Without the namespace, install straight from the URL:

pnpm dlx shadcn@latest add https://ui-skeuomorph.vercel.app/r/form.json

Usage

import { zodResolver } from "@hookform/resolvers/zod"
import { useForm } from "react-hook-form"
import * as z from "zod"
 
import {
  Form,
  FormControl,
  FormDescription,
  FormField,
  FormItem,
  FormLabel,
  FormMessage,
} from "@/components/ui/form"
import { Input } from "@/components/ui/input"
 
const formSchema = z.object({
  username: z.string().min(2).max(50),
})
 
export function ProfileForm() {
  const form = useForm<z.infer<typeof formSchema>>({
    resolver: zodResolver(formSchema),
    defaultValues: { username: "" },
  })
 
  return (
    <Form {...form}>
      <form onSubmit={form.handleSubmit(console.log)}>
        <FormField
          control={form.control}
          name="username"
          render={({ field }) => (
            <FormItem>
              <FormLabel>Username</FormLabel>
              <FormControl>
                <Input placeholder="steve" {...field} />
              </FormControl>
              <FormDescription>This is your public display name.</FormDescription>
              <FormMessage />
            </FormItem>
          )}
        />
      </form>
    </Form>
  )
}

Anatomy

<Form>
  <FormField
    control={...}
    name="..."
    render={() => (
      <FormItem>
        <FormLabel />
        <FormControl>
          {/* Your form field */}
        </FormControl>
        <FormDescription />
        <FormMessage />
      </FormItem>
    )}
  />
</Form>

Building with Field

The preview below does not use form.tsx. It wires react-hook-form and Zod to the Field components (npx shadcn@latest add @skeuomorph/field), the recommended pattern for new forms.