NOCTA UI

Form

A composable form component with field validation, labels, and actions for building accessible forms

Installation

Install the Form component component using the nocta-ui CLI:

npx @nocta-ui/cli add form

Import the component:

import {
  Form,
  FormField,
  FormLabel,
  FormControl,
  FormDescription,
  FormMessage,
  FormActions,
  FormInput,
  FormSubmit,
} from '@/components/ui/form';

Examples

Default Form

This will be displayed on your profile.

Error Handling

Handle validation in two ways:

  • Pass an error prop to FormField and place <FormMessage /> to display it.
  • Or use an Ariakit form store with validate/setError and place <FormMessage type="error" /> to read errors from the store.
Must be at least 8 characters long.

Api Reference

Form

Prop

Type

FormField

Prop

Type

FormLabel

Prop

Type

FormMessage

Prop

Type

FormActions

Prop

Type

FormInput

Prop

Type

FormSubmit

Prop

Type