Command palette

@yasinsensoy/web

Web · Components

Form

Form that manages validation together with Field.

81 exports

Live example

Preview

We'll only send you invoices.

Code

import {
  Form,
  TextField,
  SelectField,
  SwitchField,
  CheckboxField,
  SubmitButton,
} from "@yasinsensoy/web";

const [state, formAction] = useActionState(save, null);

<Form action={formAction} state={state} submitLoading="overlay">
  <TextField label="E-posta" name="email" type="email" required description="We'll only send you invoices." tooltip="We never share your address."
    messages={{ valueMissing: "This field is required" }} />
  <SelectField label="City" name="city" defaultValue="Ankara"
    items={["Istanbul", "Ankara", { group: "Aegean", items: ["Izmir", "Aydın"] }]} />
  <SwitchField label="Notifications" name="notifications" defaultChecked
    description="Notify me about new messages." />
  <CheckboxField label="I accept the terms" name="terms" required
    messages={{ valueMissing: "You must accept to continue" }} />
  <SubmitButton>Submit</SubmitButton>
</Form>

Events

  1. Events appear here when you interact with the preview.

Error display: without resizing (icon + tooltip) or with reserved space

errorDisplay="message"

errorDisplay="reserve"

errorDisplay="icon"

errorDisplay="icon-end"

Loading: skeleton until data arrives, overlay while saving

Field: connect your own element with label and validation

For age verification.

Password: press and hold, toggle or off

Press and hold the eye icon.

Press the eye icon: show, press again: hide.

No button.

Import

import {
  Form,
  Field,
  TextField,
  NumberField,
  OtpField,
  SelectField,
  AutocompleteField,
  FileField,
  DateField,
  DateRangeField,
  TimeField,
  MonthField,
  YearField,
  MentionField,
  TreeSelectField,
  CascaderField,
  TransferField,
  CheckboxField,
  SwitchField,
  RadioField,
  SubmitButton,
  RatingField,
  TagField,
  SignatureField,
  SliderField,
  useFormError,
  useFormDefault,
  readFormDraft,
  clearFormDraft,
  formDataToValues,
  validateForm,
  parseFieldName,
  formatFieldName,
  getIn,
  toJsonSchema,
  unwrapJsonSchema,
  jsonType,
  issuesToErrors,
  validateValues,
} from "@yasinsensoy/web";

Form

componentClient component

Form that manages validation together with Field. Supports all props of the native <form> (including action for server actions).

If the submit is invalid:

  • The browser's error bubbles are hidden; messages appear under the fields.
  • The first invalid field is focused and scrolled to the middle of the screen; on mobile it doesn't stay under the opened keyboard.

Validation is done with browser rules (required, minLength…) or with schema (Zod, Valibot… see FormProps.schema); both work together too. Server errors are given with state and distributed by field name.

  • With defaultValues the initial value of all fields is given in one place.
  • With draft entered values are stored as a draft and come back after a reload.
  • With loading the form turns into a skeleton, is disabled or covered by a scrim; with submitLoading this happens automatically while submitting.
Form({ ref, className, state, schema, onValidSubmit, defaultValues, draft, onDraftRestore, onValidationError, externalSubmit, loading, submitLoading, errorDisplay, onSubmit, onReset, action, children, ...props }: FormProps<Schema>): JSX.Element

Examples

const [state, formAction] = useActionState(save, null);

<Form action={formAction} state={state}>
  <TextField label="Email" name="email" type="email" required />
  <SubmitButton>Save</SubmitButton>
</Form>

// With a Zod schema: live validation on the client, the same schema on the server.
const SignUp = z.object({
  email: z.email("Enter a valid email"),
  age: z.number().int().min(18, "You must be over 18"),
  newsletter: z.boolean(),
});

<Form schema={SignUp} draft="signup" onValidSubmit={async (data) => {
  await api.signUp(data); // data: { email: string; age: number; newsletter: boolean }
}}>
  <TextField label="Email" name="email" />
  <NumberField label="Age" name="age" />
  <CheckboxField label="Newsletter" name="newsletter" />
  <SubmitButton>Sign up</SubmitButton>
</Form>

// Loading: skeleton until the data arrives; a scrim while submitting.
<Form loading={!profile} defaultValues={profile} submitLoading="overlay" action={formAction}>
  …
</Form>

Field

componentClient component

Accessibly links any form element with its label, description and error message. For text and select boxes use TextField or SelectField directly; Field is for your own elements (e.g. a date picker, a Checkbox group).

  • Validation uses the browser's rules (required, type, minLength, pattern, min/max…); no extra library needed.
  • The error is shown when the user leaves the field or tries to submit the form; it doesn't say "invalid" early while typing.
  • A red asterisk appears on the label of required elements.
  • Server errors come via error or from the nearest Form's state by name.
Field({ label, description, tooltip, error, messages, errorDisplay, className, classNames, children, }: FieldProps): JSX.Element

Examples

<Field label="Date of birth" description="For age verification."
  messages={{ valueMissing: "Date is required" }}>
  <Input name="birthDate" type="date" required />
</Field>

TextField

componentClient component

Single-line text field with its label, description and error message. It combines Field and Input itself. Icons can be placed inside the field with icon/iconEnd.

  • Validation uses the browser's rules (required, type, minLength, pattern…); the error is shown when the user leaves the field.
  • A red asterisk appears on the label of required fields.
  • Server errors come from the Form's state by name.
  • With multiline it becomes a <textarea> (takes props like autoResize).
  • type="password" fields get an eye button at the end; holding it shows the value. reveal="toggle" makes it a toggle, reveal={false} disables it.
  • With mask, patterned input such as phone, plate or IBAN (see MaskProp); for an incomplete or checksum-failing value the error appears under the field.
  • With floatingLabel the label goes inside the field and moves up when typing.
TextField(input: TextFieldProps): JSX.Element

Examples

<TextField label="Email" name="email" type="email" required autoComplete="email"
  description="The invoice goes to this address."
  messages={{ valueMissing: "Email is required" }} />

<TextField label="Search" name="q" type="search" icon="search" />
<TextField label="IBAN" name="iban" tooltip="Only accounts starting with TR." />
<TextField label="Note" name="note" multiline autoResize rows={3} />
<TextField label="Password" name="password" type="password" required autoComplete="current-password" />

<TextField label="Phone" name="phone" mask="phone" required />
<TextField label="Plate" name="plate" mask="plate" messages={{ customError: "Invalid plate" }} />
<TextField label="IBAN" name="iban" mask="iban" unmask />

<TextField label="Email" name="email" type="email" floatingLabel />
<TextField label="Name" name="name" variant="filled" floatingLabel />   // label at the top inside

NumberField

componentClient component

NumberInput with its label, description and error message. Takes all props of NumberInput (min, max, step, decimals, fixedDecimals, stepper, prefix, suffix…). classNames.control is given to the field's container.

  • The value enters FormData without separators, with a dot ("1234.56").
  • required, min, max and step are checked by browser validation; change their messages with messages (valueMissing, rangeUnderflow, rangeOverflow, stepMismatch).
NumberField(input: NumberFieldProps): JSX.Element

Examples

<NumberField label="Price" name="price" required decimals={2} fixedDecimals min={0}
  suffix="₺" messages={{ valueMissing: "Price is required" }} />

<NumberField label="Quantity" name="quantity" defaultValue={1} min={1} max={99} decimals={0} stepper />

<NumberField label="Discount" name="discount" min={0} max={100} clamp={false} suffix="%"
  messages={{ rangeOverflow: "Discount cannot exceed 100%" }} />

OtpField

componentClient component

OtpInput with its label, description and error message. Takes all props of OtpInput (length, charset, casing, groups, mask, autoSubmit, onResend…). Clicking the label focuses the first empty box; classNames.control is given to the boxes' container.

  • The code itself enters FormData.
  • An incomplete code gives a patternMismatch error, and an empty required one a valueMissing error; change the messages with messages.
  • The server's "wrong code" response comes from the Form's state; the boxes shake briefly and the error disappears when the user types a new code.
OtpField(input: OtpFieldProps): JSX.Element

Examples

<Form action={formAction} state={state}>
  <OtpField label="Verification code" name="code" required autoFocus autoSubmit groups={3}
    description="Enter the 6-digit code sent to your phone."
    messages={{ valueMissing: "Enter the code", patternMismatch: "Enter the full code" }}
    onResend={resendCode} />
</Form>

<OtpField label="PIN" name="pin" length={4} mask required />

SelectField

componentClient component

Select box with its label, description and error message. It combines Field and Select itself; takes all props of Select (items, loadItems, search, multiple, clearable…). Clicking the label opens the list.

SelectField(input: SelectFieldProps): JSX.Element

Examples

<SelectField label="City" name="city" placeholder="Select" required
  items={["Istanbul", "Ankara", { group: "Aegean", items: ["Izmir", "Aydın"] }]} />

<SelectField label="Plan" name="plan" defaultValue="pro"
  items={[{ value: "free", label: "Free" }, { value: "pro", label: "Pro", icon: "star" }]} />

AutocompleteField

componentClient component

Autocomplete with its label, description and error message. Takes all props of Autocomplete (items, loadItems, multiple, allowCustomValue…). Clicking the label focuses the text field.

AutocompleteField(input: AutocompleteFieldProps): JSX.Element

Examples

<AutocompleteField label="City" name="city" required items={cities}
  messages={{ valueMissing: "Pick a city" }} />

<AutocompleteField label="Tags" name="tag" multiple allowCustomValue
  items={["react", "nextjs"]} description="Press Enter to add a new tag." />

FileField

componentClient component

FileUpload with its label, description and error message. Takes all props of FileUpload (layout, multiple, accept, maxSize, maxFiles, upload…). Clicking the label opens the file dialog; in required fields the form is not submitted without a file and the error is written under the field. The reason for files whose type or size doesn't fit is listed separately.

FileField(props: FileFieldProps): JSX.Element

Examples

<FileField label="Documents" name="documents" multiple accept=".pdf,.docx"
  maxSize="10 MB" maxFiles={5} required
  messages={{ valueMissing: "Add at least one document" }} />

<FileField label="Photos" name="photo" layout="gallery" multiple accept="image/*"
  description="The first photo becomes the cover." />

<FileField label="Résumé" name="cv" layout="inline" accept=".pdf" />

DateField

componentClient component

DatePicker with its label, description and error message. Takes all props of DatePicker (min, max, isDateDisabled, time, presets, format…). Clicking the label opens the calendar.

  • If required, the form is not submitted without a date; values outside min/max give a rangeUnderflow/rangeOverflow error.
  • "YYYY-MM-DD" (with time "YYYY-MM-DDTHH:mm") enters FormData; on the server convert it to a Date with parseISODate.
DateField(input: DateFieldProps): JSX.Element

Examples

<DateField label="Date of birth" name="birthDate" required max={new Date()}
  messages={{ valueMissing: "Date of birth is required", rangeOverflow: "Cannot be a future date" }} />

<DateField label="Appointment" name="appointment" time minuteStep={15} min={new Date()}
  description="We are closed on Sundays." isDateDisabled={(d) => d.getDay() === 0} />

DateRangeField

componentClient component

DateRangePicker with its label, description and error message. Takes all props of DateRangePicker (presets, minDays, maxDays, months…). Clicking the label opens the calendar; required needs both ends.

"2026-10-01/2026-10-07" enters FormData; on the server split it with parseDateRange.

DateRangeField(input: DateRangeFieldProps): JSX.Element

Examples

<DateRangeField label="Stay" name="stay" required min={new Date()}
  minDays={2} maxDays={14} messages={{ valueMissing: "Pick check-in and check-out dates" }} />

<DateRangeField label="Report period" name="period"
  presets={["last7Days", "last30Days", "thisMonth", "lastMonth"]} />

TimeField

componentClient component

TimePicker with its label, description and error message. Takes all props of TimePicker (min, max, minuteStep…). "HH:mm" enters FormData.

TimeField(input: TimeFieldProps): JSX.Element

Examples

<TimeField label="Delivery time" name="time" required min="09:00" max="18:00"
  minuteStep={30} messages={{ rangeUnderflow: "No delivery before 09:00" }} />

MonthField

componentClient component

MonthPicker with its label, description and error message. "YYYY-MM" enters FormData; on the server convert it to a Date with parseISOMonth.

MonthField(input: MonthFieldProps): JSX.Element

Examples

<MonthField label="Report period" name="period" required max={new Date()}
  presets={["thisMonth", "lastMonth"]} />

YearField

componentClient component

YearPicker with its label, description and error message. "YYYY" enters FormData.

YearField(input: YearFieldProps): JSX.Element

Examples

<YearField label="Model year" name="model" min={1990} max={2027} required />

MentionField

componentClient component

MentionInput with its label, description and error message. The stored format (@[Name](id)) enters FormData; on the server parse it with parseMentions.

MentionField(input: MentionFieldProps): JSX.Element

Examples

<MentionField label="Comment" name="comment" required sources={{ trigger: "@", items: people }} />

TreeSelectField

componentClient component

TreeSelect with its label, description and error message. The selected id(s) enter FormData; for multiple selection use getAll(name).

TreeSelectField(input: TreeSelectFieldProps): JSX.Element

Examples

<TreeSelectField label="Category" name="category" required leavesOnly items={categories} />

CascaderField

componentClient component

Cascader with its label, description and error message. The path enters FormData as "istanbul/kadikoy".

CascaderField(input: CascaderFieldProps): JSX.Element

Examples

<CascaderField label="City / district" name="location" required options={cities} />

TransferField

componentClient component

Transfer with its label, description and error message. Each selected value enters FormData separately; getAll(name).

TransferField(input: TransferFieldProps): JSX.Element

Examples

<TransferField label="Role permissions" name="permissions" required items={permissions} />

CheckboxField

componentClient component

Checkbox with its label beside it and its description and error message below. In forms it behaves like TextField: if required, the form is not submitted unless checked, the error is written under the box (e.g. "You must accept the terms"), and server errors come from the Form's state by name. The whole label is clickable.

If checked, value (default "on") enters FormData under name; if unchecked, nothing does.

CheckboxField(input: CheckboxFieldProps): JSX.Element

Examples

<CheckboxField label="I accept the terms" name="terms" required
  messages={{ valueMissing: "You must accept to continue" }} />

<CheckboxField label="Newsletter" name="newsletter" defaultChecked
  description="One email a month." tooltip="You can unsubscribe at any time." />

SwitchField

componentClient component

On/off switch with its label beside it and its description and error message below. In forms it behaves like TextField: if required, the form is not submitted unless it is on and the error is written below; server errors come from the Form's state by name.

If on, value (default "on") enters FormData under name; if off, nothing does. On the server read it with data.get("notifications") === "on".

SwitchField(input: SwitchFieldProps): JSX.Element

Examples

<SwitchField label="Notifications" name="notifications" defaultChecked
  description="Notify me about new messages." />

<SwitchField label="Make the account public" name="public" size="sm" />

RadioField

componentClient component

Option group with its label, description and error message: only one of the options is selected. Takes all props of RadioGroup (options, variant, orientation, deselectable…) and behaves like TextField in forms:

  • If required, the form is not submitted without a selection; the error is written under the group and the first option is focused.
  • Server errors come from the Form's state by name; they disappear when the user picks an option.
  • The label is linked to the group with aria-labelledby; screen readers read "Plan, radio group". The description sits right under the label.

If selected, the option's value enters FormData under name; if none is selected, nothing does.

RadioField(input: RadioFieldProps): JSX.Element

Examples

<RadioField label="Delivery" name="delivery" required
  options={[
    { value: "shipping", label: "Shipping", description: "2-3 business days", aside: "₺49" },
    { value: "pickup", label: "Pick up in store", aside: "Free" },
  ]}
  messages={{ valueMissing: "Choose a delivery method" }} />

<RadioField label="Plan" name="plan" variant="card" orientation="horizontal"
  defaultValue="pro" tooltip="You can change the plan at any time."
  options={plans} />

SubmitButton

componentClient component

Button that submits the form. While the form is submitted with an action (action) it shows loading automatically and prevents a second submit (useFormStatus). Not needed inside a ready-made Dialog; its confirm button already does this.

SubmitButton({ loading, ...props }: SubmitButtonProps): JSX.Element

Examples

<Form action={formAction} state={state}>
  …
  <SubmitButton>Save</SubmitButton>
</Form>

RatingField

componentClient component

Rating with its label, description and error message. Takes all props of Rating (max, step, icon, labels, showValue…). Screen readers read the rating together with the label; in a required field the form is not submitted without a rating and the error is written below. Server errors come via error or from the nearest Form's state by name.

RatingField(input: RatingFieldProps): JSX.Element

Examples

<RatingField label="How did you like this product?" name="rating" required
  labels={["Bad", "Okay", "Good", "Very good", "Excellent"]} showValue
  messages={{ valueMissing: "Please give a rating" }} />

TagField

componentClient component

TagInput with its label, description and error message. Takes all props of TagInput (items, separators, max, validate…). Clicking the label focuses the text field; in a required field the form is not submitted until at least one tag is added.

TagField(input: TagFieldProps): JSX.Element

Examples

<TagField label="Tags" name="tags" max={5} required
  items={["react", "nextjs", "tailwind"]}
  description="Add with Enter or a comma." messages={{ valueMissing: "Add at least one tag" }} />

SignatureField

componentClient component

SignaturePad with its label, description and error message. Takes all props of SignaturePad (format, color, ref…). In a required field the form is not submitted without a signature and the error is written below. Server errors come via error or from the nearest Form's state by name.

SignatureField(props: SignatureFieldProps): JSX.Element

Examples

<SignatureField label="Signature" name="signature" required
  description="Sign to confirm you have read the contract."
  messages={{ valueMissing: "Please sign" }} />

SliderField

componentClient component

Slider with its label, value display, description and error message. Takes all props of Slider (min, max, step, marks, format, an array value for a range…).

  • The selected value (or range) is written live to the right of the label; screen readers read the value from the thumb.
  • Clicking the label focuses the first thumb; in a range each thumb is read with the label as "Start" / "End".
  • Server errors come via error or from the nearest Form's state by name; they disappear when the value changes.
SliderField(input: SliderFieldProps<V>): JSX.Element

Examples

<SliderField label="Volume" name="volume" defaultValue={40} format={{ style: "percent", maximumFractionDigits: 0 }}
  min={0} max={1} step={0.01} />

<SliderField label="Price range" name="price" defaultValue={[500, 2500]} min={0} max={5000} step={50}
  format={{ style: "currency", currency: "TRY", maximumFractionDigits: 0 }}
  description="Shipping included." />

useFormError

function

Returns a field's server error from the state value of the nearest Form. TextField and SelectField use it themselves; useful when writing your own field component.

useFormError(name: string | undefined): string | undefined

Returns the field's initial value from the defaultValues (or restored draft) of the nearest Form. Ready-made fields use it themselves; the name can be nested like "address.city".

useFormDefault(name: string | undefined): unknown

Reads the draft; null if corrupt or expired.

readFormDraft(key: string, options?: Pick<FormDraftOptions, "storage" | "maxAge">): Record<string, unknown> | null

Deletes the draft (e.g. when the user says "Discard draft").

clearFormDraft(key: string, options?: Pick<FormDraftOptions, "storage">): void

Turns FormData into a nested object. Works both in the browser and on the server.

  • address.city → { address: { city } }, items[0].name → { items: [{ name }] }.
  • Multiple values with the same name (multi-select, tags) → an array.
  • An empty file input is skipped. React's internal fields ($ACTION_…) are skipped.
  • If the schema types are known, numbers, booleans and arrays are converted; an unchecked checkbox becomes false.
formDataToValues(formData: FormData, options?: FormDataToValuesOptions): Record<string, unknown>

Examples

const values = formDataToValues(formData, { schema: SignUpSchema });

validateForm

function

Validates the submitted FormData with the schema; used in a server action. If it returns errors, the result can be passed directly as the Form's state: the messages appear under the fields.

validateForm(schema: Schema, formData: FormData): Promise<FormValidation<StandardSchemaV1.InferOutput<Schema>>>

Examples

"use server";
import { validateForm } from "@yasinsensoy/web";
import { SignUpSchema } from "./schema";

export async function signUp(_: unknown, formData: FormData) {
  const result = await validateForm(SignUpSchema, formData);
  if (!result.success) return result; // { errors, formErrors }
  await db.user.insert(result.data); // typed: { email: string; age: number; … }
  return { ok: true };
}

Converts a field name to a path: "address.city" → ["address", "city"], "items[0].name" → ["items", 0, "name"], "tags[]" → ["tags", undefined].

parseFieldName(name: string): Segment[]

Converts a path to a field name: ["items", 0, "name"] → "items[0].name".

formatFieldName(path: ReadonlyArray<PropertyKey | { key: PropertyKey; }>): string

getIn

function

Reads a value from an object by field name: getIn(values, "address.city").

getIn(source: unknown, name: string): unknown

toJsonSchema

function

Returns the schema's JSON Schema (via Standard JSON Schema; otherwise null). Computed once per schema.

toJsonSchema(schema: StandardSchemaV1 | null | undefined): JsonSchema | null

Returns the effective shape of the node: the first non-null option in anyOf/oneOf, or the allOf merge. The nullable flag is returned separately.

unwrapJsonSchema(node: JsonSchema | undefined, root: JsonSchema): {
    node: JsonSchema | undefined

jsonType

function

Type of the node ("string", "number", "boolean", "array", "object"…).

jsonType(node: JsonSchema | undefined): string | undefined

Converts Standard Schema issues into errors by field name. An error on an array item (e.g. tags[2]) is also written under the array's own name (tags), so arrays shown as a single field also show the error.

issuesToErrors(issues: ReadonlyArray<StandardSchemaV1.Issue>): {
    errors: FormErrors

Validates values with a schema. Returns synchronously for sync schemas and a Promise for async ones.

validateValues(schema: Schema, values: unknown): FormValidation<StandardSchemaV1.InferOutput<Schema>> | Promise<FormValidation<StandardSchemaV1.InferOutput<Schema>>>

How a field error is shown. Set with the field's errorDisplay prop, Form errorDisplay and UIProvider errorDisplay; the nearest one wins.

  • "message": the message is written below the field (classic). When an error appears the field grows by one line; elements below shift.
  • "reserve": the message is still below, but one line of space is reserved up front; nothing shifts when an error appears (the field grows for messages longer than two lines).
  • "icon": a red ⓘ icon appears left of the label and the message shows in a tooltip (on hover, on field focus, or on tap on mobile). The field size never changes. Screen readers still read the message as the field's description (aria-describedby).
  • "icon-end": like "icon", with the icon right of the label.
type ErrorDisplay = "message" | "reserve" | "icon" | "icon-end"

Error keys in the browser's validity state (ValidityState).

type ValidityKey = "valueMissing" | "typeMismatch" | "patternMismatch" | "tooLong" | "tooShort" | "rangeUnderflow" | "rangeOverflow" | "stepMismatch" | "badInput" | "customError"

FormState

interface

Form state returned by a server action (e.g. useActionState). Only errors and formErrors are read; the rest is free. The result of validateForm is already in this shape.

NameTypeDescription
errors?Record<string, string | readonly string[] | undefined> | null | undefinedError messages by field name (name). If an array is given, the first message is shown (compatible with Zod's flatten().fieldErrors shape).
formErrors?readonly string[] | null | undefinedErrors that don't belong to any field; shown in a box above the form.

Form draft options.

NameTypeDefaultDescription
keystringStorage key; must be unique for each form with a draft on the page.
storage?"local" | "session""local"Where it is stored: "local" survives closing the browser, "session" is deleted when the tab closes.
exclude?readonly string[]Field names not written to the draft. Password and file fields are never written.
maxAge?number7 daysThe draft is not restored if older than this (milliseconds).

How the Form looks while loading.

  • skeleton: fields, labels and buttons turn into pale boxes at the same place and size (same as Skeleton loading). To show the form before the data arrives; nothing shifts when the data comes.
  • disabled: all fields and buttons are disabled (with their own disabled look); the form stays readable as is.
  • overlay: a semi-transparent scrim with a spinner in the middle covers the form; the scrim blocks clicks. In a long form the spinner stays on screen.

In all three the fields cannot be reached by keyboard or touch (inert) and the form is aria-busy.

type FormLoadingMode = "skeleton" | "disabled" | "overlay"

Detailed options of FormProps.loading.

NameTypeDefaultDescription
mode?FormLoadingMode"skeleton"Look. See FormLoadingMode.
text?ReactNodeoverlay: text next to the spinner (e.g. "Saving…").
animation?SkeletonAnimation"pulse"skeleton: animation of the boxes. See SkeletonAnimation.
delay?number0overlay: time to wait before the scrim appears (milliseconds). For short tasks the scrim doesn't blink on and off; clicks are still blocked immediately.

Detailed options of FormProps.submitLoading.

NameTypeDefaultDescription
mode?"disabled" | "overlay""disabled"Look: disabled or overlay. See FormLoadingMode.
text?ReactNodeoverlay: text next to the spinner (e.g. "Saving…").
delay?number150overlay: time to wait before the scrim appears (milliseconds).

FormProps

interface

Props of the Form component.

Extends: Omit<ComponentProps<"form">, "defaultValue">

NameTypeDefaultDescription
state?FormState | null | undefinedState returned by a server action. Its errors are distributed by field name to fields like TextField and SelectField automatically; you don't need to pass error to each field. formErrors are shown above the form.
schema?SchemaValidation schema: Zod, Valibot, ArkType… (any library supporting Standard Schema). No extra package needed. - Fields are validated as you type; the message appears under the field when the user leaves it or tries to submit (same as browser rules). - If invalid, the form is not submitted and the first invalid field is focused. - The error is found by matching the field name (name) with the path in the schema: address.city, items[0].name. Errors without a field appear above the form. - If the schema also offers Standard JSON Schema (Zod 4.2+), values are converted to their types: a number field becomes number, a checkbox boolean, a multi-select an array; z.coerce is not needed. - Async schemas (refine(async …)) are supported. On the server use validateForm with the same schema.
onValidSubmit?(data: FormValues<Schema>, formData: FormData) => void | Promise<void>Called when the schema passes; data is the schema's output (typed). If no action is given the page does not reload. If async, SubmitButton shows loading until it finishes. If it throws, the entered values are kept. Without a schema, data is the object extracted from the FormData.
defaultValues?Partial<StandardSchemaV1.InferInput<Schema>> | Record<string, unknown>Initial values of the fields by field name ({ name: "Ayşe", address: { city: "İzmir" } }). Ready-made fields take their value from here; if a field is also given defaultValue, that wins.
draft?string | FormDraftOptionsStores the entered values as a draft in the browser; they come back even if the page reloads or closes. Deleted on a successful submit and when the form is reset. Password and file fields are not stored. A string is used as the storage key.
onDraftRestore?(values: Record<string, unknown>) => voidCalled when the draft is restored (e.g. for a "Draft restored" notice).
onValidationError?(errors: FormErrors, formErrors: string[]) => voidTo see schema errors before they are distributed to the fields. Errors without a field are in formErrors.
loading?boolean | FormLoadingMode | FormLoadingOptionsShows the form as loading: true or "skeleton" turns fields into pale boxes, "disabled" disables everything, "overlay" puts a click-blocking scrim on top. See FormLoadingMode. For details pass an object: { mode: "overlay", text: "Fetching…" }. With disabled and overlay the fields are not rebuilt: typed values and selections are kept, and focus returns to the focused field when done. After skeleton the fields are rebuilt once, so defaultValues arriving with the data reach the fields.
submitLoading?boolean | "disabled" | "overlay" | FormSubmitLoadingOptionsfalse` (only {@link SubmitButton} shows loading)Look of the form while submitting (while the action or an async onValidSubmit runs): "disabled" (or true) disables the fields, "overlay" puts a scrim. So the user cannot change values while submitting. If loading is given, it wins.
errorDisplay?ErrorDisplay"message"` (message under the field)Error display mode of all fields in the form. A field's own errorDisplay overrides this, and this overrides UIProvider errorDisplay. See ErrorDisplay.

Classes that can be passed to the inner parts of ready-made fields.

NameTypeDescription
root?stringContainer wrapping the field.
label?stringLabel.
control?stringThe form element itself (<input>, <textarea>, <select>).
description?stringHelp text.
error?stringError message.

FieldOwnProps

interface

Shared props of ready-made fields.

NameTypeDefaultDescription
labelReactNodeVisible label of the field. Required; the accessible name comes from it.
description?ReactNodeHelp text under the field.
tooltip?TooltipPropHint shown with an ⓘ icon next to the label. For extra info that doesn't need to be visible all the time; write important info in description. Screen readers read it when reaching the icon. See TooltipProp.
error?stringError from outside (e.g. a server action). If omitted, it is taken from the nearest Form's state.errors by the field's name.
messages?Partial<Record<ValidityKey, ReactNode>>Custom messages per validation rule. For rules not given, the browser's message (in the user's language) is shown.
errorDisplay?ErrorDisplay"message"How the error is shown: "message" (below), "reserve" (below, with space reserved up front), "icon" / "icon-end" (an icon left/right of the label, message in the tooltip; the field's size never changes). If omitted, Form or UIProvider errorDisplay. See ErrorDisplay.
className?stringClasses added to the container.
classNames?FieldClassNamesClasses added to the inner parts.

FieldProps

interface

Props of the Field component.

NameTypeDefaultDescription
childrenReactElementA single form element: Input, Textarea, Select, Checkbox or your own component. The id, aria-describedby and aria-invalid are given to it automatically; name, required and id are read from it.
labelReactNodeVisible label of the field. Required; the accessible name comes from it.
description?ReactNodeHelp text under the field.
tooltip?TooltipPropHint shown with an ⓘ icon next to the label. For extra info that doesn't need to be visible all the time; write important info in description. Screen readers read it when reaching the icon. See TooltipProp.
error?stringError from outside (e.g. a server action). If omitted, it is taken from the nearest Form's state.errors by the field's name.
messages?Partial<Record<ValidityKey, ReactNode>>Custom messages per validation rule. For rules not given, the browser's message (in the user's language) is shown.
errorDisplay?ErrorDisplay"message"How the error is shown: "message" (below), "reserve" (below, with space reserved up front), "icon" / "icon-end" (an icon left/right of the label, message in the tooltip; the field's size never changes). If omitted, Form or UIProvider errorDisplay. See ErrorDisplay.
className?stringClasses added to the container.
classNames?FieldClassNamesClasses added to the inner parts.

Props of the TextField component.

Extends: Omit<InputProps, "className" | "label" | "floatingLabel"> | Omit<TextareaProps, "className">

NameTypeDefaultDescription
labelReactNodeVisible label of the field. Required; the accessible name comes from it.
description?ReactNodeHelp text under the field.
tooltip?TooltipPropHint shown with an ⓘ icon next to the label. For extra info that doesn't need to be visible all the time; write important info in description. Screen readers read it when reaching the icon. See TooltipProp.
error?stringError from outside (e.g. a server action). If omitted, it is taken from the nearest Form's state.errors by the field's name.
messages?Partial<Record<ValidityKey, ReactNode>>Custom messages per validation rule. For rules not given, the browser's message (in the user's language) is shown.
errorDisplay?ErrorDisplay"message"How the error is shown: "message" (below), "reserve" (below, with space reserved up front), "icon" / "icon-end" (an icon left/right of the label, message in the tooltip; the field's size never changes). If omitted, Form or UIProvider errorDisplay. See ErrorDisplay.
className?stringClasses added to the container.
classNames?FieldClassNamesClasses added to the inner parts.
multiline?false | trueIf true, it becomes a multi-line text area (<textarea>).
floatingLabel?FloatingLabelfalse` (label above the field)Puts the label inside the field (floating label): while the field is * empty it sits inside like a placeholder, and on focus or when filled it * shrinks and moves up. The description and error message still appear * below the field. * * - true: by appearance: on the top border for outline fields, at the * top inside the box for filled/underline/ghost fields. * - "border": on the top border in every appearance. * - "inside": at the top inside the box (the field becomes 48 px). * * The app-wide default is set in one place with UIProvider * floatingLabel; this prop overrides it. See FloatingLabel. * *(({ /** If `true`, it becomes a multi-line text area (`<textarea>`). */ multiline?: false; /** * Puts the label inside the field (floating label): while the field is * empty it sits inside like a placeholder, and on focus or when filled it * shrinks and moves up. The description and error message still appear * below the field. * * - `true`: by appearance: on the top border for `outline` fields, at the * top inside the box for `filled`/`underline`/`ghost` fields. * - `"border"`: on the top border in every appearance. * - `"inside"`: at the top inside the box (the field becomes 48 px). * * The app-wide default is set in one place with {@link UIProvider} * `floatingLabel`; this prop overrides it. See {@link FloatingLabel}. * * @defaultValue `false` (label above the field) */ floatingLabel?: FloatingLabel; } & Omit<InputProps, "className" | "label" | "floatingLabel">))

Props of the NumberField component.

type NumberFieldProps = FieldOwnProps & Omit<NumberInputProps, "className">

Extends: Omit<NumberInputProps, "className">

NameTypeDefaultDescription
labelReactNodeVisible label of the field. Required; the accessible name comes from it.
description?ReactNodeHelp text under the field.
tooltip?TooltipPropHint shown with an ⓘ icon next to the label. For extra info that doesn't need to be visible all the time; write important info in description. Screen readers read it when reaching the icon. See TooltipProp.
error?stringError from outside (e.g. a server action). If omitted, it is taken from the nearest Form's state.errors by the field's name.
messages?Partial<Record<ValidityKey, ReactNode>>Custom messages per validation rule. For rules not given, the browser's message (in the user's language) is shown.
errorDisplay?ErrorDisplay"message"How the error is shown: "message" (below), "reserve" (below, with space reserved up front), "icon" / "icon-end" (an icon left/right of the label, message in the tooltip; the field's size never changes). If omitted, Form or UIProvider errorDisplay. See ErrorDisplay.
className?stringClasses added to the container.
classNames?FieldClassNamesClasses added to the inner parts.

Props of the OtpField component.

type OtpFieldProps = FieldOwnProps & Omit<OtpInputProps, "className">

Extends: Omit<OtpInputProps, "className">

NameTypeDefaultDescription
labelReactNodeVisible label of the field. Required; the accessible name comes from it.
description?ReactNodeHelp text under the field.
tooltip?TooltipPropHint shown with an ⓘ icon next to the label. For extra info that doesn't need to be visible all the time; write important info in description. Screen readers read it when reaching the icon. See TooltipProp.
error?stringError from outside (e.g. a server action). If omitted, it is taken from the nearest Form's state.errors by the field's name.
messages?Partial<Record<ValidityKey, ReactNode>>Custom messages per validation rule. For rules not given, the browser's message (in the user's language) is shown.
errorDisplay?ErrorDisplay"message"How the error is shown: "message" (below), "reserve" (below, with space reserved up front), "icon" / "icon-end" (an icon left/right of the label, message in the tooltip; the field's size never changes). If omitted, Form or UIProvider errorDisplay. See ErrorDisplay.
className?stringClasses added to the container.
classNames?FieldClassNamesClasses added to the inner parts.

Props of the SelectField component.

type SelectFieldProps = FieldOwnProps & DistributiveOmit<SelectProps, "className">

Extends: Omit<SelectProps, "className">

NameTypeDefaultDescription
labelReactNodeVisible label of the field. Required; the accessible name comes from it.
description?ReactNodeHelp text under the field.
tooltip?TooltipPropHint shown with an ⓘ icon next to the label. For extra info that doesn't need to be visible all the time; write important info in description. Screen readers read it when reaching the icon. See TooltipProp.
error?stringError from outside (e.g. a server action). If omitted, it is taken from the nearest Form's state.errors by the field's name.
messages?Partial<Record<ValidityKey, ReactNode>>Custom messages per validation rule. For rules not given, the browser's message (in the user's language) is shown.
errorDisplay?ErrorDisplay"message"How the error is shown: "message" (below), "reserve" (below, with space reserved up front), "icon" / "icon-end" (an icon left/right of the label, message in the tooltip; the field's size never changes). If omitted, Form or UIProvider errorDisplay. See ErrorDisplay.
className?stringClasses added to the container.
classNames?FieldClassNamesClasses added to the inner parts.

Props of the AutocompleteField component.

type AutocompleteFieldProps = FieldOwnProps & DistributiveOmit<AutocompleteProps, "className">

Extends: Omit<AutocompleteProps, "className">

NameTypeDefaultDescription
labelReactNodeVisible label of the field. Required; the accessible name comes from it.
description?ReactNodeHelp text under the field.
tooltip?TooltipPropHint shown with an ⓘ icon next to the label. For extra info that doesn't need to be visible all the time; write important info in description. Screen readers read it when reaching the icon. See TooltipProp.
error?stringError from outside (e.g. a server action). If omitted, it is taken from the nearest Form's state.errors by the field's name.
messages?Partial<Record<ValidityKey, ReactNode>>Custom messages per validation rule. For rules not given, the browser's message (in the user's language) is shown.
errorDisplay?ErrorDisplay"message"How the error is shown: "message" (below), "reserve" (below, with space reserved up front), "icon" / "icon-end" (an icon left/right of the label, message in the tooltip; the field's size never changes). If omitted, Form or UIProvider errorDisplay. See ErrorDisplay.
className?stringClasses added to the container.
classNames?FieldClassNamesClasses added to the inner parts.

Props of the FileField component.

Extends: Omit<FileUploadProps, "className" | "classNames" | "tooltip">

NameTypeDefaultDescription
labelReactNodeVisible label of the field. Required; the accessible name comes from it.
description?ReactNodeHelp text under the field.
tooltip?TooltipPropHint shown with an ⓘ icon next to the label. For extra info that doesn't need to be visible all the time; write important info in description. Screen readers read it when reaching the icon. See TooltipProp.
error?stringError from outside (e.g. a server action). If omitted, it is taken from the nearest Form's state.errors by the field's name.
messages?Partial<Record<ValidityKey, ReactNode>>Custom messages per validation rule. For rules not given, the browser's message (in the user's language) is shown.
errorDisplay?ErrorDisplay"message"How the error is shown: "message" (below), "reserve" (below, with space reserved up front), "icon" / "icon-end" (an icon left/right of the label, message in the tooltip; the field's size never changes). If omitted, Form or UIProvider errorDisplay. See ErrorDisplay.
className?stringClasses added to the container.
classNames?FieldClassNames & FileUploadClassNamesClasses added to the inner parts: the field's parts (FieldClassNames; * control is the upload area's container) and the upload area's parts * (dropzone, list, item).

Classes that can be passed to the inner parts of date and time fields.

type PickerFieldClassNames = FieldClassNames & PickerClassNames

Extends: PickerClassNames

NameTypeDescription
root?stringContainer wrapping the field.
label?stringLabel.
control?stringThe form element itself (<input>, <textarea>, <select>).
description?stringHelp text.
error?stringError message.

Props of the DateField component.

type DateFieldProps = PickerFieldProps<DatePickerProps>

Extends: Omit<DatePickerProps, "className" | "classNames">

NameTypeDefaultDescription
labelReactNodeVisible label of the field. Required; the accessible name comes from it.
description?ReactNodeHelp text under the field.
tooltip?TooltipPropHint shown with an ⓘ icon next to the label. For extra info that doesn't need to be visible all the time; write important info in description. Screen readers read it when reaching the icon. See TooltipProp.
error?stringError from outside (e.g. a server action). If omitted, it is taken from the nearest Form's state.errors by the field's name.
messages?Partial<Record<ValidityKey, ReactNode>>Custom messages per validation rule. For rules not given, the browser's message (in the user's language) is shown.
errorDisplay?ErrorDisplay"message"How the error is shown: "message" (below), "reserve" (below, with space reserved up front), "icon" / "icon-end" (an icon left/right of the label, message in the tooltip; the field's size never changes). If omitted, Form or UIProvider errorDisplay. See ErrorDisplay.
className?stringClasses added to the container.
classNames?PickerFieldClassNamesClasses added to the inner parts: the field's parts (FieldClassNames; * control is the picker's container) and the picker's parts (box, * input, content).

Props of the DateRangeField component.

type DateRangeFieldProps = PickerFieldProps<DateRangePickerProps>

Extends: Omit<DateRangePickerProps, "className" | "classNames">

NameTypeDefaultDescription
labelReactNodeVisible label of the field. Required; the accessible name comes from it.
description?ReactNodeHelp text under the field.
tooltip?TooltipPropHint shown with an ⓘ icon next to the label. For extra info that doesn't need to be visible all the time; write important info in description. Screen readers read it when reaching the icon. See TooltipProp.
error?stringError from outside (e.g. a server action). If omitted, it is taken from the nearest Form's state.errors by the field's name.
messages?Partial<Record<ValidityKey, ReactNode>>Custom messages per validation rule. For rules not given, the browser's message (in the user's language) is shown.
errorDisplay?ErrorDisplay"message"How the error is shown: "message" (below), "reserve" (below, with space reserved up front), "icon" / "icon-end" (an icon left/right of the label, message in the tooltip; the field's size never changes). If omitted, Form or UIProvider errorDisplay. See ErrorDisplay.
className?stringClasses added to the container.
classNames?PickerFieldClassNamesClasses added to the inner parts: the field's parts (FieldClassNames; * control is the picker's container) and the picker's parts (box, * input, content).

Props of the TimeField component.

type TimeFieldProps = PickerFieldProps<TimePickerProps>

Extends: Omit<TimePickerProps, "className" | "classNames">

NameTypeDefaultDescription
labelReactNodeVisible label of the field. Required; the accessible name comes from it.
description?ReactNodeHelp text under the field.
tooltip?TooltipPropHint shown with an ⓘ icon next to the label. For extra info that doesn't need to be visible all the time; write important info in description. Screen readers read it when reaching the icon. See TooltipProp.
error?stringError from outside (e.g. a server action). If omitted, it is taken from the nearest Form's state.errors by the field's name.
messages?Partial<Record<ValidityKey, ReactNode>>Custom messages per validation rule. For rules not given, the browser's message (in the user's language) is shown.
errorDisplay?ErrorDisplay"message"How the error is shown: "message" (below), "reserve" (below, with space reserved up front), "icon" / "icon-end" (an icon left/right of the label, message in the tooltip; the field's size never changes). If omitted, Form or UIProvider errorDisplay. See ErrorDisplay.
className?stringClasses added to the container.
classNames?PickerFieldClassNamesClasses added to the inner parts: the field's parts (FieldClassNames; * control is the picker's container) and the picker's parts (box, * input, content).

Props of the MonthField component.

type MonthFieldProps = PickerFieldProps<MonthPickerProps>

Extends: Omit<MonthPickerProps, "className" | "classNames">

NameTypeDefaultDescription
labelReactNodeVisible label of the field. Required; the accessible name comes from it.
description?ReactNodeHelp text under the field.
tooltip?TooltipPropHint shown with an ⓘ icon next to the label. For extra info that doesn't need to be visible all the time; write important info in description. Screen readers read it when reaching the icon. See TooltipProp.
error?stringError from outside (e.g. a server action). If omitted, it is taken from the nearest Form's state.errors by the field's name.
messages?Partial<Record<ValidityKey, ReactNode>>Custom messages per validation rule. For rules not given, the browser's message (in the user's language) is shown.
errorDisplay?ErrorDisplay"message"How the error is shown: "message" (below), "reserve" (below, with space reserved up front), "icon" / "icon-end" (an icon left/right of the label, message in the tooltip; the field's size never changes). If omitted, Form or UIProvider errorDisplay. See ErrorDisplay.
className?stringClasses added to the container.
classNames?PickerFieldClassNamesClasses added to the inner parts: the field's parts (FieldClassNames; * control is the picker's container) and the picker's parts (box, * input, content).

Props of the YearField component.

type YearFieldProps = PickerFieldProps<YearPickerProps>

Extends: Omit<YearPickerProps, "className" | "classNames">

NameTypeDefaultDescription
labelReactNodeVisible label of the field. Required; the accessible name comes from it.
description?ReactNodeHelp text under the field.
tooltip?TooltipPropHint shown with an ⓘ icon next to the label. For extra info that doesn't need to be visible all the time; write important info in description. Screen readers read it when reaching the icon. See TooltipProp.
error?stringError from outside (e.g. a server action). If omitted, it is taken from the nearest Form's state.errors by the field's name.
messages?Partial<Record<ValidityKey, ReactNode>>Custom messages per validation rule. For rules not given, the browser's message (in the user's language) is shown.
errorDisplay?ErrorDisplay"message"How the error is shown: "message" (below), "reserve" (below, with space reserved up front), "icon" / "icon-end" (an icon left/right of the label, message in the tooltip; the field's size never changes). If omitted, Form or UIProvider errorDisplay. See ErrorDisplay.
className?stringClasses added to the container.
classNames?PickerFieldClassNamesClasses added to the inner parts: the field's parts (FieldClassNames; * control is the picker's container) and the picker's parts (box, * input, content).

Props of the MentionField component.

Extends: Omit<MentionInputProps, "className" | "classNames">

NameTypeDefaultDescription
labelReactNodeVisible label of the field. Required; the accessible name comes from it.
description?ReactNodeHelp text under the field.
tooltip?TooltipPropHint shown with an ⓘ icon next to the label. For extra info that doesn't need to be visible all the time; write important info in description. Screen readers read it when reaching the icon. See TooltipProp.
error?stringError from outside (e.g. a server action). If omitted, it is taken from the nearest Form's state.errors by the field's name.
messages?Partial<Record<ValidityKey, ReactNode>>Custom messages per validation rule. For rules not given, the browser's message (in the user's language) is shown.
errorDisplay?ErrorDisplay"message"How the error is shown: "message" (below), "reserve" (below, with space reserved up front), "icon" / "icon-end" (an icon left/right of the label, message in the tooltip; the field's size never changes). If omitted, Form or UIProvider errorDisplay. See ErrorDisplay.
className?stringClasses added to the container.
classNames?FieldClassNames & MentionInputProps["classNames"]Classes added to the inner parts (control is the mention box's container).

Props of the TreeSelectField component.

Extends: TreeSelectProps extends infer P ? P extends unknown ? Omit<P, "className" | "classNames"> : never : never

NameTypeDefaultDescription
labelReactNodeVisible label of the field. Required; the accessible name comes from it.
description?ReactNodeHelp text under the field.
tooltip?TooltipPropHint shown with an ⓘ icon next to the label. For extra info that doesn't need to be visible all the time; write important info in description. Screen readers read it when reaching the icon. See TooltipProp.
error?stringError from outside (e.g. a server action). If omitted, it is taken from the nearest Form's state.errors by the field's name.
messages?Partial<Record<ValidityKey, ReactNode>>Custom messages per validation rule. For rules not given, the browser's message (in the user's language) is shown.
errorDisplay?ErrorDisplay"message"How the error is shown: "message" (below), "reserve" (below, with space reserved up front), "icon" / "icon-end" (an icon left/right of the label, message in the tooltip; the field's size never changes). If omitted, Form or UIProvider errorDisplay. See ErrorDisplay.
className?stringClasses added to the container.
classNames?FieldClassNames & TreeSelectProps["classNames"]Classes added to the inner parts (control is the picker's container).

Props of the CascaderField component.

Extends: Omit<CascaderProps, "className" | "classNames">

NameTypeDefaultDescription
labelReactNodeVisible label of the field. Required; the accessible name comes from it.
description?ReactNodeHelp text under the field.
tooltip?TooltipPropHint shown with an ⓘ icon next to the label. For extra info that doesn't need to be visible all the time; write important info in description. Screen readers read it when reaching the icon. See TooltipProp.
error?stringError from outside (e.g. a server action). If omitted, it is taken from the nearest Form's state.errors by the field's name.
messages?Partial<Record<ValidityKey, ReactNode>>Custom messages per validation rule. For rules not given, the browser's message (in the user's language) is shown.
errorDisplay?ErrorDisplay"message"How the error is shown: "message" (below), "reserve" (below, with space reserved up front), "icon" / "icon-end" (an icon left/right of the label, message in the tooltip; the field's size never changes). If omitted, Form or UIProvider errorDisplay. See ErrorDisplay.
className?stringClasses added to the container.
classNames?FieldClassNames & CascaderProps["classNames"]Classes added to the inner parts (control is the picker's container).

Props of the TransferField component.

Extends: Omit<TransferProps, "className" | "classNames">

NameTypeDefaultDescription
labelReactNodeVisible label of the field. Required; the accessible name comes from it.
description?ReactNodeHelp text under the field.
tooltip?TooltipPropHint shown with an ⓘ icon next to the label. For extra info that doesn't need to be visible all the time; write important info in description. Screen readers read it when reaching the icon. See TooltipProp.
error?stringError from outside (e.g. a server action). If omitted, it is taken from the nearest Form's state.errors by the field's name.
messages?Partial<Record<ValidityKey, ReactNode>>Custom messages per validation rule. For rules not given, the browser's message (in the user's language) is shown.
errorDisplay?ErrorDisplay"message"How the error is shown: "message" (below), "reserve" (below, with space reserved up front), "icon" / "icon-end" (an icon left/right of the label, message in the tooltip; the field's size never changes). If omitted, Form or UIProvider errorDisplay. See ErrorDisplay.
className?stringClasses added to the container.
classNames?FieldClassNames & TransferProps["classNames"]Classes added to the inner parts (control is the transfer box's container).

Props of the CheckboxField component.

type CheckboxFieldProps = ChoiceOwnProps & Omit<CheckboxProps, "label" | "description" | "tooltip" | "className">

Extends: Omit<CheckboxProps, "label" | "description" | "tooltip" | "className">

NameTypeDefaultDescription
labelReactNodeVisible label of the field. Required; the accessible name comes from it.
description?ReactNodeHelp text under the field.
tooltip?TooltipPropHint shown with an ⓘ icon next to the label. For extra info that doesn't need to be visible all the time; write important info in description. Screen readers read it when reaching the icon. See TooltipProp.
error?stringError from outside (e.g. a server action). If omitted, it is taken from the nearest Form's state.errors by the field's name.
messages?Partial<Record<ValidityKey, ReactNode>>Custom messages per validation rule. For rules not given, the browser's message (in the user's language) is shown.
errorDisplay?ErrorDisplay"message"How the error is shown: "message" (below), "reserve" (below, with space reserved up front), "icon" / "icon-end" (an icon left/right of the label, message in the tooltip; the field's size never changes). If omitted, Form or UIProvider errorDisplay. See ErrorDisplay.
className?stringClasses added to the container.
classNames?Pick<FieldClassNames, "root" | "label" | "error">Classes added to the inner parts: root is the container, label the * clickable label row, error the error message.

Props of the SwitchField component.

type SwitchFieldProps = ChoiceOwnProps & Omit<SwitchProps, "label" | "description" | "tooltip" | "className">

Extends: Omit<SwitchProps, "label" | "description" | "tooltip" | "className">

NameTypeDefaultDescription
labelReactNodeVisible label of the field. Required; the accessible name comes from it.
description?ReactNodeHelp text under the field.
tooltip?TooltipPropHint shown with an ⓘ icon next to the label. For extra info that doesn't need to be visible all the time; write important info in description. Screen readers read it when reaching the icon. See TooltipProp.
error?stringError from outside (e.g. a server action). If omitted, it is taken from the nearest Form's state.errors by the field's name.
messages?Partial<Record<ValidityKey, ReactNode>>Custom messages per validation rule. For rules not given, the browser's message (in the user's language) is shown.
errorDisplay?ErrorDisplay"message"How the error is shown: "message" (below), "reserve" (below, with space reserved up front), "icon" / "icon-end" (an icon left/right of the label, message in the tooltip; the field's size never changes). If omitted, Form or UIProvider errorDisplay. See ErrorDisplay.
className?stringClasses added to the container.
classNames?Pick<FieldClassNames, "root" | "label" | "error">Classes added to the inner parts: root is the container, label the * clickable label row, error the error message.

Props of the RadioField component.

type RadioFieldProps = FieldOwnProps & Omit<RadioGroupProps, "className">

Extends: Omit<RadioGroupProps, "className">

NameTypeDefaultDescription
labelReactNodeVisible label of the field. Required; the accessible name comes from it.
description?ReactNodeHelp text under the field.
tooltip?TooltipPropHint shown with an ⓘ icon next to the label. For extra info that doesn't need to be visible all the time; write important info in description. Screen readers read it when reaching the icon. See TooltipProp.
error?stringError from outside (e.g. a server action). If omitted, it is taken from the nearest Form's state.errors by the field's name.
messages?Partial<Record<ValidityKey, ReactNode>>Custom messages per validation rule. For rules not given, the browser's message (in the user's language) is shown.
errorDisplay?ErrorDisplay"message"How the error is shown: "message" (below), "reserve" (below, with space reserved up front), "icon" / "icon-end" (an icon left/right of the label, message in the tooltip; the field's size never changes). If omitted, Form or UIProvider errorDisplay. See ErrorDisplay.
className?stringClasses added to the container.
classNames?FieldClassNamesClasses added to the inner parts.

Props of the SubmitButton component.

type SubmitButtonProps = Omit<ButtonAsButtonProps, "type">

Props of the RatingField component.

type RatingFieldProps = FieldOwnProps & Omit<RatingProps, "className" | "classNames">

Extends: Omit<RatingProps, "className" | "classNames">

NameTypeDefaultDescription
labelReactNodeVisible label of the field. Required; the accessible name comes from it.
description?ReactNodeHelp text under the field.
tooltip?TooltipPropHint shown with an ⓘ icon next to the label. For extra info that doesn't need to be visible all the time; write important info in description. Screen readers read it when reaching the icon. See TooltipProp.
error?stringError from outside (e.g. a server action). If omitted, it is taken from the nearest Form's state.errors by the field's name.
messages?Partial<Record<ValidityKey, ReactNode>>Custom messages per validation rule. For rules not given, the browser's message (in the user's language) is shown.
errorDisplay?ErrorDisplay"message"How the error is shown: "message" (below), "reserve" (below, with space reserved up front), "icon" / "icon-end" (an icon left/right of the label, message in the tooltip; the field's size never changes). If omitted, Form or UIProvider errorDisplay. See ErrorDisplay.
className?stringClasses added to the container.
classNames?FieldClassNamesClasses added to the inner parts.

Props of the TagField component.

Extends: Omit<TagInputProps, "className" | "classNames">

NameTypeDefaultDescription
labelReactNodeVisible label of the field. Required; the accessible name comes from it.
description?ReactNodeHelp text under the field.
tooltip?TooltipPropHint shown with an ⓘ icon next to the label. For extra info that doesn't need to be visible all the time; write important info in description. Screen readers read it when reaching the icon. See TooltipProp.
error?stringError from outside (e.g. a server action). If omitted, it is taken from the nearest Form's state.errors by the field's name.
messages?Partial<Record<ValidityKey, ReactNode>>Custom messages per validation rule. For rules not given, the browser's message (in the user's language) is shown.
errorDisplay?ErrorDisplay"message"How the error is shown: "message" (below), "reserve" (below, with space reserved up front), "icon" / "icon-end" (an icon left/right of the label, message in the tooltip; the field's size never changes). If omitted, Form or UIProvider errorDisplay. See ErrorDisplay.
className?stringClasses added to the container.
classNames?FieldClassNames & TagInputClassNamesClasses added to the inner parts: the field's parts (FieldClassNames; * control is the tag box's frame) and the tag input's parts * (input, tag, message, content, item).

Standard Schema interface (v1). Schemas from libraries such as Zod, Valibot and ArkType satisfy it out of the box.

formDataToValues options.

NameTypeDescription
schema?StandardSchemaV1 | nullSchema to read the types from. If it offers Standard JSON Schema, values are converted; otherwise they stay strings (an empty string becomes undefined).
jsonSchema?JsonSchema | nullA JSON Schema directly (instead of a schema).
arrays?Readonly<Record<string, { length: number; object?: boolean; }>>Arrays with a known row count (e.g. FieldArray), by name. An array with no rows left becomes []; with object: true rows with all fields left empty are also kept as {}, so the row count and order don't shift.

Standard JSON Schema converter.

NameTypeDescription
input(options: { /** Target version. */ readonly target: string; /** Library-specific options. */ readonly libraryOptions?: Record<string, unknown>; }) => Record<string, unknown>JSON Schema of the input side of the schema.

Value type produced by a form schema.

type FormValues = Schema extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<Schema> : Record<string, unknown>

Error messages by field name (name). Same shape as FormState errors; can be returned directly from a server action.

type FormErrors = Record<string, string[]>

Result of validateForm.

NameTypeDescription
successtrue | falseValues are valid.
data?Output | undefinedValue returned by the schema (transformed, typed).
errors?undefined | FormErrorsEmpty on success.
formErrors?undefined | string[]Empty on success.

Simplified JSON Schema node.

NameTypeDescription
type?string | string[]Type ("string", "number"…) or a list of types.
properties?Record<string, JsonSchema>Object properties.
required?string[]Required property names.
items?JsonSchemaSchema of the array items.
prefixItems?JsonSchema[]Tuple items.
anyOf?JsonSchema[]At least one of the options.
oneOf?JsonSchema[]Exactly one of the options.
allOf?JsonSchema[]All of them at once.
enum?unknown[]Allowed values.
const?unknownThe single allowed value.
$ref?stringReference to another definition.
$defs?Record<string, JsonSchema>Definitions.
definitions?Record<string, JsonSchema>Definitions (old name).
default?unknownDefault value.

Props of the SignatureField component.

type SignatureFieldProps = FieldOwnProps & Omit<SignaturePadProps, "className" | "classNames">

Extends: Omit<SignaturePadProps, "className" | "classNames">

NameTypeDefaultDescription
labelReactNodeVisible label of the field. Required; the accessible name comes from it.
description?ReactNodeHelp text under the field.
tooltip?TooltipPropHint shown with an ⓘ icon next to the label. For extra info that doesn't need to be visible all the time; write important info in description. Screen readers read it when reaching the icon. See TooltipProp.
error?stringError from outside (e.g. a server action). If omitted, it is taken from the nearest Form's state.errors by the field's name.
messages?Partial<Record<ValidityKey, ReactNode>>Custom messages per validation rule. For rules not given, the browser's message (in the user's language) is shown.
errorDisplay?ErrorDisplay"message"How the error is shown: "message" (below), "reserve" (below, with space reserved up front), "icon" / "icon-end" (an icon left/right of the label, message in the tooltip; the field's size never changes). If omitted, Form or UIProvider errorDisplay. See ErrorDisplay.
className?stringClasses added to the container.
classNames?FieldClassNamesClasses added to the inner parts.

Props of the SliderField component.

Extends: Omit<SliderProps<V>, "className">

NameTypeDefaultDescription
labelReactNodeVisible label of the field. Required; the accessible name comes from it.
description?ReactNodeHelp text under the field.
tooltip?TooltipPropHint shown with an ⓘ icon next to the label. For extra info that doesn't need to be visible all the time; write important info in description. Screen readers read it when reaching the icon. See TooltipProp.
error?stringError from outside (e.g. a server action). If omitted, it is taken from the nearest Form's state.errors by the field's name.
messages?Partial<Record<ValidityKey, ReactNode>>Custom messages per validation rule. For rules not given, the browser's message (in the user's language) is shown.
errorDisplay?ErrorDisplay"message"How the error is shown: "message" (below), "reserve" (below, with space reserved up front), "icon" / "icon-end" (an icon left/right of the label, message in the tooltip; the field's size never changes). If omitted, Form or UIProvider errorDisplay. See ErrorDisplay.
className?stringClasses added to the container.
classNames?FieldClassNamesClasses added to the inner parts.
showValue?boolean | ((value: V) => ReactNode)trueShow the selected value to the right of the label? If true, it is * written with format (for a range ₺500 – ₺2.500); with a function, the * returned content is shown.