Integrated ResearchPicasso
Components

Field

Label, control and message, wired together. The wrapper every form control belongs in.

{/* Generated by scripts/build-component-docs.mjs — do not edit. The source is the component folder: guidance.json, the doc block and the props. Change those. */}

Label, control and message, wired together. The wrapper every form control belongs in.

Import

import { Field, FieldLabel, FieldControl, FieldOption, FieldDescription, FieldError } from "@ir/ui";

Props

Field

PropTypeRequiredWhat it does
invalidbooleanSets aria-invalid on the control and swaps the hint for the error.
disabledbooleanDisables the control and dims the label and hint.

FieldLabel

PropTypeRequiredWhat it does
requiredbooleanRenders the asterisk and sets required on the control.
helpReact.ReactNodeFigma's Help icon: a (?) after the label that explains the field in a tooltip. For background — anything needed to answer belongs in the hint.

FieldControl

PropTypeRequiredWhat it does
requiredbooleanMarks the control required, to pair with FieldLabel's asterisk.

FieldOption

PropTypeRequiredWhat it does
controlReact.ReactElementyesThe control the row belongs to — a Checkbox, a Radio, a Switch.
childrenReact.ReactNodeyesThe label.
descriptionReact.ReactNodeA second line under the label. Outside the <label>, so it describes the control rather than becoming part of its name.

Do and don't

Wrap them in Field.

Don't — Lay out a label, an input and a hint by hand.

Hand-laid fields are where htmlFor, aria-describedby and aria-invalid go missing — they are invisible when they are wrong, so nothing catches it. Field generates the ids and hangs the wiring off them.

Pair every invalid state with a message that says what to do.

Don't — Set invalid without rendering a FieldError.

Invalid with no error leaves a red border and nothing else — and because the hint is swapped out, the field says less than it did when it was valid.

Let the error replace the hint, and repeat any format detail the error needs.

Don't — Try to show the hint and the error at once.

A screen reader announcing a format hint and a failure together is noisier than announcing the failure. If the format still matters, say it in the error: "MOS is measured to one decimal. Use 3.6."

Pass required to FieldLabel and FieldControl together.

Don't — Mark required with an asterisk alone.

The asterisk is aria-hidden, because a screen reader reading "star" is not information. aria-required is what carries the fact; the asterisk is its visual half.

Mark whichever set is smaller — required, or optional.

Don't — Asterisk every field in a form where all of them are required.

A column of asterisks carries no information. If only two fields of twelve are optional, label those two.

Use it to describe the expected shape — "Letters, digits and hyphens".

Don't — Use the hint to warn — "Don't use spaces".

A hint written as a prohibition reads as an error that has already happened, so people check whether they have done something wrong before they have typed anything.

Pass disabled to Field.

Don't — Disable the control and leave the label at full strength.

A live-looking label above a dead control reads as a bug. Field dims the label and hint with the control, in one place.

Use help for background, and the hint for anything needed to fill the field in.

Don't — Put what someone needs to answer in the help tooltip.

A tooltip is hidden until someone thinks to open it, and not at all on touch. The hint is always there.

Use FieldOption.

Don't — Lay a Checkbox or Radio beside its label by hand.

A hand-laid row leaves the words dead: the control is 16px square, which is under the 24px floor (WCAG 2.2 AA, 2.5.8) and nowhere near a thumb. FieldOption wraps both in one <label>, so the whole row is the target without the control looking any different.

Put it beside the row.

Don't — Put a help button or a remove control inside an option row.

The row is a <label>, so it forwards every click inside it to its control — a second button there would toggle the checkbox instead of doing its own job. FieldLabel's help sits outside the label for the same reason.

Accessibility

  • The label is a real <label htmlFor>, so clicking it focuses the control and the hit target includes the text.
  • FieldError carries role="alert", so the failure is announced when it appears rather than when focus happens to reach the control.
  • aria-describedby points at the hint while valid and at the error while invalid — never at both, and never at a node that is not rendered.
  • The required asterisk is aria-hidden; aria-required on the control is what assistive tech reads.
  • The label names the control; a description is wired with aria-describedby instead, so a second line explains the option rather than becoming part of its name.
  • Row height is 24 everywhere and 44 under (pointer: coarse), so a thumb gets a 44px target without desktop density changing. See docs/foundations/responsive.md.

Where it is drawn

Figma — structure from figma, measurements from shadcn.

Open in Storybook

On this page