ObjectUIObjectUI

Label

Text label for form elements

The Label component renders accessible labels for form fields.

Basic Usage

Form Label

{
  "type": "flex",
  "direction": "column",
  "gap": 2,
  "children": [
    {
      "type": "label",
      "text": "Email",
      "htmlFor": "email"
    },
    {
      "type": "input",
      "id": "email",
      "placeholder": "Enter your email"
    }
  ]
}

Required Field

Required Label

{
  "type": "flex",
  "direction": "column",
  "gap": 2,
  "children": [
    {
      "type": "label",
      "text": "Password",
      "required": true,
      "htmlFor": "password"
    },
    {
      "type": "password",
      "id": "password"
    }
  ]
}

Schema

interface LabelSchema {
  type: 'label';
  text: string;                   // Label text
  htmlFor?: string;               // Associated input ID
  required?: boolean;             // Show required indicator
  className?: string;
}

On this page