HextaUI

Field: Disabled

Disabling a <FieldSet /> disables every field and control inside it. Pass disabled to a single <Field /> to disable just that one.

Billing details

Managed by your organization’s admin.

import { Checkbox } from "@/components/ui/checkbox"
import {
  Field,
  FieldDescription,
  FieldGroup,
  FieldLabel,
  FieldLegend,
  FieldSet,
} from "@/components/ui/field"
import { Input } from "@/components/ui/input"

export function FieldDisabled() {
  return (
    <FieldSet disabled className="w-full max-w-sm">
      <FieldLegend>Billing details</FieldLegend>
      <FieldDescription>Managed by your organization’s admin.</FieldDescription>
      <FieldGroup>
        <Field>
          <FieldLabel>Company</FieldLabel>
          <Input defaultValue="Acme Inc." />
        </Field>
        <Field orientation="horizontal">
          <Checkbox defaultChecked />
          <FieldLabel>Send invoices by email</FieldLabel>
        </Field>
      </FieldGroup>
    </FieldSet>
  )
}

This adds the example as components/examples/field/disabled.tsx, together with the Field component and the HextaUI theme tokens it needs.

pnpm dlx shadcn@latest add https://hextaui.com/r/field-disabled.json

To add only the component, follow the Field installation.

Props in this example

The Field props this example sets, from the API reference.

PropTypeDefault
orientation
"vertical" | "horizontal" | "responsive""vertical"
PropTypeDefault
disabledDisables every field inside.
booleanfalse

Every prop is in the Field API reference.

See them all, with keyboard support and accessibility notes, on the Field page.