Form field

Form field is a neobrutalist React component from Cruise UI. Label (with an optional Required marker), the control, a hint and an error with an icon; wires the ARIA for you. Install it with npx shadcn@latest add @cruiseui/form-field.

Install

Terminal

npx shadcn@latest add @cruiseui/form-field

First time? Installation shows the one-off components.json setup (the @cruiseui registry) and how to turn the theme on.

Example

Corners

As it appears on your ID.

We'll text you when the rider leaves.

Choose your state.

When to use it

When to use

Around any form control: Input, Textarea, Select, Combobox, Naira and Phone inputs.

When not to

Checkboxes, radios and switches (they carry their own label).

Props

CruiseFormField

PropTypeDefaultDescription
labelReactNode——
required?booleanfalseShows "Required" next to the label and marks the control required.
hint?ReactNode—Helper text under the control.
error?ReactNode—Error message: --danger border on the control, the message below.
id?string—The control's id (generated when left out).
className?string——
childrenReactNode——

Accessibility

  • The label is a real <label> tied to the control's id.
  • Hint and error ids go into the control's aria-describedby; an error sets aria-invalid.
  • The error has an icon and words, never colour alone.