Components › Forms

Label and Field

A form label, and Field: label, control and hint or error in one, wired together for screen readers.

Installation

npx plankui@latest add label

Usage

import { Label } from "@/components/ui/label";

<Field label="Email" hint="We only use this for receipts." error={error}>
  <Input type="email" />
</Field>

API reference

PropTypeDefaultDescription
labelReactNodeShown above the control and linked to it.
hintReactNodeHelp text below the control, linked with aria-describedby.
errorReactNodeReplaces the hint in red and marks the control invalid.
htmlForstringThe control's id. Leave it out and Field assigns one.

View the source on GitHub