Komponents
Components

Components

Form

Accessible form container for native and custom field validation.

newfree
pnpm add @komponents/uiCanonical TypeScript source · tree-shakeable subpaths

Thin wrapper around React Aria Form. Compose Komponents fields inside and use native constraint validation or validationErrors for server feedback.

Editors can publish; viewers cannot.

Usage

Snippet
import { Button, Form, TextField } from "@komponents/ui";

<Form onSubmit={(event) => event.preventDefault()}>
  <TextField label="Email" name="email" type="email" isRequired />
  <Button type="submit">Continue</Button>
</Form>

Notes

  • No React Hook Form or Formik dependency
  • Fields keep their own labels, descriptions, and errors
  • Use validationErrors for server-side messages keyed by field name

Accessibility

  • Landmark form role when labeled
  • Focus moves to the first invalid field on failed submit

On this page