8.7k

Form

A form wrapper component that simplifies validation and submission.

API Reference

Installation

pnpm dlx shadcn@latest add @coss/form

Usage

import {
  Field,
  FieldError,
  FieldLabel,
} from "@/components/ui/field"
import { Form } from "@/components/ui/form"
import { Input } from "@/components/ui/input"
<Form
  onSubmit={(e) => {
    /* handle submit */
  }}
>
  <Field>
    <FieldLabel>Email</FieldLabel>
    <Input name="email" type="email" required />
    <FieldError>Please enter a valid email.</FieldError>
  </Field>
</Form>

Examples

Using with Zod

coss.com ui

Built by and for the team of Cal.com, Inc. — the leading commercial open source company (“coss”).