Label + control + hint/error in one unit with htmlFor, aria-describedby, and aria-invalid wiring applied automatically.

npx slipstream-ui@latest add form-field
Hint & error states

We never share your email

Max 280 characters

A small form

Optional — used on invoices

Props

PropTypeDefaultDescription
idstringrequiredThe control's id — shared with the label's htmlFor and hint/error ids.
labelstringrequiredVisible label text (kept for screen readers when labelHidden).
hintstring—Helper text under the control, wired via aria-describedby.
errorstring—Validation error; replaces the hint, sets aria-invalid, announced via role=alert.
requiredbooleanfalseRenders the required marker next to the label.
labelHiddenbooleanfalseKeeps the label sr-only while hiding it visually.
childrenReactNode—Exactly one control element — id/aria wiring is cloned onto it.

Accessibility

  • Label pairs via htmlFor/id automatically.
  • aria-describedby points at the hint — or the error when one is present.
  • Errors render with role=alert and flip aria-invalid on the control.
  • The required asterisk is aria-hidden; native required comes from the control itself.

Browser support

BrowserTested versions
Chrome111+ (Mar 2023)
Edge111+ (Mar 2023)
Firefox121+ (Dec 2023)
Safari17.2+ — macOS & iOS (Dec 2023)

Slipstream components rely only on CSS custom properties, Flexbox/Grid, and ARIA — the everyday baseline of the last two years of evergreen releases. Anything newer is progressive enhancement: unsupported browsers keep full functionality with static behavior instead of animations.

  • id/aria cloning and role=alert are plain DOM — works in every supported browser.
Was this page helpful?