Field

PreviousNext

Individual form field component with label, input, validation, and multiple field types

A flexible field component for building forms with text inputs, selects, textareas, checkboxes, and switches. Includes built-in label, description, error handling, and validation support.

For collections of fields with layout options and drag-and-drop, see Fields.

Basic Usage

A simple text field with label and placeholder.

Field Types

The Field component supports multiple input types, each with appropriate keyboard and validation behavior.

Text-based Fields

Text, number, email, tel, url, and date inputs with browser-native validation and mobile keyboard optimization.

Text Area

Multi-line text input with configurable rows.

Select Dropdown

Dropdown selection with predefined options.

Boolean Fields

Checkbox

Checkbox input for binary choices, typically with explicit consent or agreement.

Switch

Toggle switch for settings and preferences, typically with on/off states.

Receive email notifications about updates

Validation & Errors

Helper Text

Add description text to provide guidance or formatting requirements.

Choose a unique username (3-20 characters)

Must be at least 8 characters with uppercase and lowercase letters

Error Messages

Display validation errors with semantic styling and ARIA attributes.

Required Fields

Mark required fields with an asterisk indicator.

Field States

Disabled State

Disable field interaction for locked or unavailable options.

Read-only Display

Use the readonly variant to display field values without form inputs.

usr_1234567890

2024-01-15

Active

Orientation

Horizontal Layout

Place label and input side-by-side instead of stacked. Particularly useful for switches and checkboxes in settings panels.

Receive updates via email

Receive updates via SMS

Form Integration

Complete form example with state management, validation, and error handling.

We'll never share your email

Optional: Share a brief description

Receive updates about new features and releases

API Reference

FieldItemProps

PropTypeDefaultDescription
fieldFieldItemData-Field configuration object
variant"editable" | "readonly" | "compact""editable"Display mode
size"default" | "sm" | "lg""default"Size variant
orientation"vertical" | "horizontal""vertical"Label/input layout
onChange(id, value) => void-Called when value changes
onBlur(id) => void-Called when field loses focus
classNamesobject-CSS classes for sub-components

FieldItemData Interface

PropertyTypeDescription
idstring | numberUnique field identifier
labelstringField label text
valuestring | numberCurrent field value (for text inputs)
checkedbooleanCurrent checked state (for checkbox/switch)
placeholderstringPlaceholder text
descriptionstringHelper text displayed below input
errorstringError message (replaces description)
type"text" | "number" | "email" | "tel" | "url" | "date" | "textarea" | "select" | "checkbox" | "switch"Input type
requiredbooleanMark field as required
disabledbooleanDisable field interaction
optionsArray<{label: string, value: string}>Options for select type
rowsnumberNumber of rows for textarea (default: 3)
render(field) => ReactNodeCustom render function