Skip to content

Early previewhamur is not on npm yet. The components are being built in the open, follow along on GitHub.

UIComponentsReact

Field

A form control with its label, description and error, wired together.

Built on the headless Field.See its API in Docs

Rendered by React 19.3.1

field.tsx

Installation

npx shadcn@4.23.0 add https://hamur.dev/r/react/field.json

It also adds utils, label, separator. The app needs its setup first: Installation.

Usage

Wrap a control in Field with a FieldLabel, a FieldDescription and a FieldError; the Field labels the control, describes it and shows the error when it is invalid. FieldSet and FieldLegend group fields, FieldGroup stacks them.

import {
  Field,
  FieldLabel,
  FieldDescription,
  FieldError,
  FieldGroup,
  FieldLegend,
  FieldSeparator,
  FieldSet,
  FieldContent,
  FieldTitle,
} from '@/components/ui/field'

Examples

Default

An email field with its description.

Its preview and code are at the top of the page.

API reference

The styled parts pass every prop to the headless part they wrap and add classes. The props, data attributes and keyboard are on Field's API reference.