Skip to main content

Starwind UI v3.0 is now available! Migration guide

This name appears on your public profile.

Installation

Usage

For complete validation policies, custom and asynchronous validation, schema adapters, and submission flows using Field and FieldSet, see the Form examples.

Groups and non-input controls

Use FieldSet with FieldLegend when several controls answer one question or belong to the same settings section. FieldItem gives checkboxes, radios, and other non-text controls the same label, description, validation, disabled-state, and layout conventions as text inputs.

Preferences

Receive occasional release notes.

API Reference

Styled Component API

These props are added or materially changed by the installed styled component. Standard HTML attributes remain available through the inherited interfaces noted below. Expand a prop to see named type definitions and framework-specific imports. Follow the Primitive and Runtime links for lower-level behavior props.

Field

Inherits div attributes.

Contains the following additional props:

Prop Type Default Toggle details
errorVisibility "blur" | "change" | "manual" | "submit"
Description
Selects whether semantic change, blur, submit, or manual validation reveals errors; inherits the owning Form policy when omitted.
Classification
Primitive override
Primitive prop
field.Root.errorVisibility
orientation "horizontal" | "responsive" | "vertical" "vertical"
Description
Selects the horizontal or vertical layout direction.
Classification
Styled variant
revalidationTiming "blur" | "change" | "manual" | "submit"
Description
After an owning Form submission attempt, replaces validationTiming with semantic change, blur, submit, or manual validation; inherits the owning Form policy when omitted.
Classification
Primitive override
Primitive prop
field.Root.revalidationTiming
validationTiming "blur" | "change" | "manual" | "submit"
Description
Selects semantic change, blur, submit, or manual validation before an owning Form submission attempt; inherits the owning Form policy when omitted.
Classification
Primitive override
Primitive prop
field.Root.validationTiming

Field Legend

Inherits div attributes.

Contains the following additional props:

Prop Type Default Toggle details
variant "label" | "legend" "legend"
Description
Selects the component's visual variant.
Classification
Styled variant

Field Group

Inherits div attributes.

Contains the following additional props:

Prop Type Default Toggle details
variant "default" | "outline" "default"
Description
Selects the component's visual variant.
Classification
Styled variant

Field Label

Inherits label attributes.

Contains the following additional props:

Prop Type Default Toggle details
size "sm" | "md" | "lg" "md"
Description
Selects the component's visual size.
Classification
Styled variant

Field Control

Inherits input attributes. Omits `children`, `defaultValue`, `size`, and `value`.

Contains the following additional props:

Prop Type Default Toggle details
defaultValue string | number | string[]
Description
Sets the initial value when the component is uncontrolled.
Classification
Wrapper prop
Type imports
React import type { InputValue } from "@starwind-ui/react";
size "sm" | "md" | "lg" "md"
Description
Selects the component's visual size.
Classification
Styled variant
value string | number | string[]
Description
Controls or identifies the component value.
Classification
Wrapper prop
Type imports
React import type { InputValue } from "@starwind-ui/react";

Field Error

Inherits div attributes.

Contains the following additional props:

Prop Type Default Toggle details
match boolean | "badInput" | "customError" | "patternMismatch" | "rangeOverflow" | "rangeUnderflow" | "stepMismatch" | "tooLong" | "tooShort" | "typeMismatch" | "valid" | "valueMissing"
Description
Selects the validation state that renders this message.
Classification
Primitive override
Primitive prop
field.Error.match

Field Validity

Inherits div attributes.

Contains the following additional props:

Prop Type Default Toggle details
match boolean | "badInput" | "customError" | "patternMismatch" | "rangeOverflow" | "rangeUnderflow" | "stepMismatch" | "tooLong" | "tooShort" | "typeMismatch" | "valid" | "valueMissing"
Description
Selects the validation state that renders this message.
Classification
Wrapper prop

Primitive And Runtime API

Use these references when you need the lower-level behavior APIs behind Field.

Runtime API

Field primitive
createField from @starwind-ui/runtime/field
Fieldset primitive
createFieldset from @starwind-ui/runtime/fieldset

Changelog

v1.0.1

  • Named the generated aggregate default export so React and Astro tooling can identify the installed component cleanly.

v1.0.0

  • Added the Runtime-backed Field family with validation, grouping, labels, descriptions, and accessible messages.
  • See the Field Primitive and Fieldset Primitive for the underlying unstyled anatomy and behavior API.