Field label

Label, description, and error treatment stacked above a form control.

Shown on invoices and in the client portal.

Installation
$Terminal
npx shadcn@latest add https://sdk-components.thesqd.com/r/field-label.json
Usage
Render the label block above any control and wire `htmlFor` to the control's id.
TSImport
import { FieldLabel } from "@/components/ui/field-label";
TSExample
import { FieldLabel } from "@/components/ui/field-label";
import { Input } from "@/components/ui/input";

export function Example() {
  return (
    <div className="flex flex-col gap-1.5">
      <FieldLabel
        htmlFor="project-name"
        label="Project name"
        caption="Shown on invoices and in the client portal."
        required
      />
      <Input id="project-name" placeholder="Acme rebrand" />
    </div>
  );
}
Composition
Anatomy of the FieldLabel primitive.
FieldLabel                       (single component — pass everything as props)
├── label={<ReactNode>}          (required — the visible label text)
├── caption={<ReactNode>}        (optional helper text under the label)
├── required={boolean}           (renders a red asterisk after the label)
├── error={boolean}              (reddens the label — render the message below the control)
├── disabled={boolean}           (softens label / caption color)
└── htmlFor={string}             (wires <label htmlFor> to the control id)
Default
Just the label — paired above any control.
Required
Adds a red asterisk after the label.
*
With caption
Helper text sits directly under the label, above the control.

Shown on invoices and in the client portal.

Error
Reddens the label and renders the error message under the description.
*

Shown on invoices and in the client portal.

API Reference
Props exposed by the FieldLabel component.
PropTypeDefaultDescription
labelReactNodeVisible label text rendered above the control.
captionReactNodeHelper text rendered directly under the label (not under the control).
requiredbooleanfalseRenders a red asterisk after the label.
errorbooleanfalseMarks the field invalid — reddens the label. Render the error message below the control.
disabledbooleanfalseSoftens the label / caption color.
htmlForstringWires the underlying `<label htmlFor>` to the control's id.
classNamestringOverride or extend the wrapper classes.