Skip to content
Eskais UI

Forms

Field

UI SDK Field parts: label, description and validation errors wired to the control; FieldSet with a legend that names the group.

Example

We only use it for deploy alerts.

Installation

npx shadcn@latest add @eskais/field

Usage

Import
import {  Field,  fieldSurfaceClassName,  FieldDescription,  FieldError,  FieldGroup,  FieldLabel,  FieldLabelPlacementDefault,  FieldLegend,  FieldSet,  floatingLabelControls,  formControlAdapters,  padsItself,  useFieldLabelPlacement,  useFloatingPlaceholder,} from "@/components/ui/field"

API reference

Field

PropTypeDefault
labelPlacement`top` (default) above the control; `in` inside it, floating up on focus or a value; `on` on its border, over `--field-label-surface`. For text controls (Input, Textarea, Select, NumberInput, DatePicker, Combobox…). Unset in a Form, it takes the Form's only in the floating layout (`FieldLabel`, such a control, then only a description or error, no padding of its own). Wins over the Form's, `top` included."top" | "in" | "on"–

Also takes every prop of UI SDK Field.

FieldSet

PropTypeDefault
legendNames the group, and the radio or checkbox group inside it.ReactNode–
descriptionReactNode–
childrenReactNode–

Also takes every prop of UI SDK FieldSet except children.

Other exports

fieldSurfaceClassNameFieldLabelPlacementDefaultfloatingLabelControlsformControlAdapterspadsItselfuseFieldLabelPlacementuseFloatingPlaceholdertype FieldLabelPlacementtype FieldPropstype FieldSetPropstype FormControlAdapter

Accessibility

  • FieldLabel, FieldDescription and FieldError are linked to the control automatically.
  • FieldError matches native validity states (valueMissing, typeMismatch…), shown after the field is touched.

Agent actions

Runs agent.snapshot() from @ui-sdk/react/agent on the live preview above.