Skip to content
Components

Field

Form field wrapper for labels, descriptions, errors, and validity state.

Examples

Choice card

FieldLabel variant="card" turns a label around a Radio or Checkbox into a selectable tile. The whole card selects the control, its border and fill follow the checked state, one focus ring wraps the card, and a disabled control disables the card. Wrap each card in FieldItem so every label targets its own control inside one Field; in a grid, every card fills its row to the tallest one.

Composition

Labeled control

FieldLegend names the set: a label-size semibold title by default, or variant="section" for a list title. Re-value --cui-field-legend-foreground, --cui-field-legend-font-size, and --cui-field-legend-font-weight through its style prop for a muted caption legend.

  • <FieldSet>
    • <FieldLegend />
    • <FieldGroup>
      • <Field>
        • <FieldLabel />
        • <FieldControl>
          • render prop
            • <Input />
          </FieldControl>
        • <FieldDescription />
        • <FieldError />
        </Field>
      • <FieldSeparator />
      </FieldGroup>
    </FieldSet>

Choice card

FieldLabel variant="card" paints the selectable tile: the whole card selects its control, the checked control colors its border and fill, and one focus ring wraps the card. FieldItem gives each label its own control inside the shared Field; FieldItem disabled disables one option. A Checkbox takes the Radio's place for multiple choice.

  • <Field>
    • <RadioGroup>
      • <FieldItem>
        • <FieldLabel>
          • <Radio />
          • <FieldContent>
            • <FieldTitle />
            • <FieldDescription />
            </FieldContent>
          </FieldLabel>
        </FieldItem>
      </RadioGroup>
    </Field>

Settings list

FieldLegend variant="section" titles the list. FieldGroup variant="card" pads every row and draws the dividers between rows, so rows need no classes. Field orientation="responsive" moves the control beside its text once the group is wide enough. Skins tune rows through the --cui-field-group-* knobs and label weight through --cui-field-label-font-weight.

  • <FieldSet>
    • <FieldLegend />
    • <FieldGroup>
      • <Field>
        • <FieldContent>
          • <FieldLabel />
          • <FieldDescription />
          </FieldContent>
        • control
        </Field>
      </FieldGroup>
    </FieldSet>

Installation

The Control UI source installs this component from src/registry/sources/control-ui/ui/field.tsx.

Registry command
See registry manifest

Dependencies

Raw code

Primary installed source

src/registry/sources/control-ui/ui/field.tsx

Knobs

Typed custom properties the recipe paints with. Set one on the root — style, a utility class, or a skin — and every slot inherits it.

--cui-field-* · 41 knobsHow the cascade resolves
--cui-field-label-radius<length-percentage>var(--radius-control)
--cui-field-label-background<color>transparent
--cui-field-label-hover-background<color>var(--hover-fill)
--cui-field-label-checked-background<color>oklch(from var(--primary) l c h / 0.06)
--cui-field-label-border-color<color>var(--border)
--cui-field-label-checked-border-color<color>var(--primary)
--cui-field-label-border-width<length>var(--control-rim-width)
--cui-field-label-padding-block<length-percentage>calc(var(--spacing) * 3)
--cui-field-label-padding-inline<length-percentage>calc(var(--spacing) * 3)
--cui-field-legend-foreground<color>var(--foreground)
--cui-field-legend-font-size<length-percentage>var(--text-label)
--cui-field-legend-font-weight<number>var(--font-weight-semibold)
--cui-field-radius<length-percentage>var(--nest-radius, var(--radius-control))
--cui-field-background<color>var(--control-fill)
--cui-field-hover-background<color>var(--hover-fill)
--cui-field-affordance-background<color>transparent
--cui-field-affordance-shadow*0 0 transparent
--cui-field-affordance-foreground<color>var(--muted-foreground)
--cui-field-affordance-hover-background<color>var(--hover-fill)
--cui-field-foreground<color>var(--foreground)
--cui-field-border-color<color>var(--control-rim)
--cui-field-border-width<length>var(--control-rim-width)
--cui-field-shadow*var(--shadow-inset)
--cui-field-backdrop-filter*blur(0px)
--cui-field-height<length-percentage>var(--control-h-md)
--cui-field-padding-inline<length-percentage>var(--padding-x)
--cui-field-font-size<length-percentage>var(--text-body)
--cui-field-font-weight<number>var(--font-weight-normal)
--cui-field-font-family*var(--font-body)
--cui-field-group-radius<length-percentage>var(--radius-panel)
--cui-field-group-background<color>var(--card)
--cui-field-group-border-color<color>var(--border)
--cui-field-group-border-width<length>1px
--cui-field-group-shadow*0 0 transparent
--cui-field-group-padding-block<length-percentage>calc(var(--spacing) * 3)
--cui-field-group-padding-inline<length-percentage>calc(var(--spacing) * 4)
--cui-field-group-separator-color<color>var(--border)
--cui-field-group-separator-inset<length-percentage>0px
--cui-field-label-font-size<length-percentage>var(--text-label)
--cui-field-label-font-weight<number>var(--font-weight-medium)
--cui-field-description-font-size<length-percentage>var(--text-caption)