ui

Field

A component that provides labelling and validation for form controls. Built with Base UI and Tailwind CSS. Copy-paste ready.

API Reference

Installation

Usage

Examples

Required Field

Add the required prop to the control inside Field to display a required indicator on the label and enable browser-native constraint validation.

With Error

Enter an invalid email address and press enter to see the error.

With Validity

Use FieldValidity to render custom UI based on the current validation state — such as a checkmark when the field is valid.

Input Group

Wrap an InputGroup inside Field to get label association and error messaging for complex input compositions.

Autocomplete Field

Use Field with Autocomplete to wire up an accessible label, required validation, and visible error for suggestion inputs.

Combobox Field

Use Field with Combobox for single-selection dropdowns that need accessible labelling and form validation.

Combobox Multi-select

Combines Field with a multi-select Combobox so chip-based selections are validated and described accessibly.

Textarea Field

Wraps a Textarea in Field to provide a label, description, and character-count error for multi-line inputs.

Select Field

Pairs Field with Select for validated dropdown fields with visible labels and inline error messages.

Checkbox Field

A single checkbox wrapped in Field to associate an accessible label with the control and show validation feedback.

Checkbox Group Field

A CheckboxGroup wrapped in Field and Fieldset for group-level labelling, description, and validation.

Radio Group Field

A RadioGroup inside Field and Fieldset to validate that the user has selected one of the available options.

Switch Field

A Switch inside Field for accessible toggle fields that need a visible label and optional error messaging.

Slider Field

Wraps a Slider in Field to provide an accessible label and connect the value to form validation.

Number Field

A NumberField inside Field with a label and error message for validated numeric inputs.

Complete Form

A multi-field form showcasing how Field composes with various input types, all wired up with labels, descriptions, and error messages.

Switch Field

An inline Switch toggle with a label and description, laid out side-by-side using flex-row for compact preference controls.

Date Field

A native date Input wrapped in Field to provide an accessible label, description, and inline error for date-of-birth or deadline inputs.

OTP Field

An OtpField inside Field for verification-code entry, with label, description, and an error message when the code is invalid.

File Upload Field

A type="file" input inside Field with an accept attribute, description of allowed formats, and an error message for invalid uploads.

Password Strength

Uses FieldValidity to render a live strength meter — four coloured bars and a label that update as the user types their new password.