Skip to contentKino
Skip to Content

Field

A label, a control and a line under it, where the description rolls out and the error rolls in. With no description, the line opens as an error arrives.

npx shadcn add https://kinoui.com/r/field.json
Share on

Examples

Invoices and receipts go here.

Default

Submit it empty: the description rolls out of its line and the error rolls in, so the form around it stays still.

kinoui.com/

Your team finds the workspace here.

kinoui.com/acme is taken. Try acme-team.

From the server

For a check that runs elsewhere, set invalid on the field and give FieldError the message. Try a free address.

Billing address

Fieldset

Group fields that belong together under a legend.

Installation

npx shadcn@latest add https://kinoui.com/r/field.json
Files
components/kino/label.tsxlib/reduce-motion.tslib/resize.tslib/settle.tscomponents/kino/field.tsx
Packages
@base-ui/react

New to Kino? Installation covers what your project needs first and the @kino namespace.

API reference

Form

PropTypeDefaultDescription
onFormSubmit(values: Record<string, unknown>, details) => unknownNoneRuns with the values once every field is valid. Return a promise to keep the form saving until it settles, while a second submit is ignored; a rejection or a throw means it failed, and its error still reaches the console. The Save bar shows each of these.

Field

PropTypeDefaultDescription
namestringNoneThe name its value is sent with, and its errors are keyed by.
validate(value, formValues) => string | string[] | nullNoneReturns the error for a value, or null when it is fine.
invalidbooleanNoneMakes the field invalid from outside, such as after a server check. Leave it undefined to let validate decide.
disabledbooleanfalseDisables the control and dims the label.

FieldError

PropTypeDefaultDescription
matchbooleankeyof ValidityStateNoneShows it only for one kind of invalid, such as valueMissing, even with children.

Data attributes

AttributeOnDescription
data-invalidFieldPresent while the field is invalid.
data-disabledFieldPresent while the field is disabled.

CSS variables

VariableSet it onDefaultDescription
--field-message-rollField, or <body>0.5remHow far the description and the error roll as one takes the other's place.

Accessibility

  • The label names the control, and the description and the error describe it.
  • The error line is a polite live region that is there before the error arrives, so a screen reader reads the error out as it appears.
  • On submit, focus moves to the first invalid field.
  • An invalid control has a red border and a mark in its box, as well as its error, so it never relies on colour alone.
  • When the system asks for less motion, the description and the error only fade.