For the complete documentation index, see llms.txt. Markdown variants are available by appending .md to any URL or sending an Accept: text/markdown header. An agent skill is available at /.well-known/agent-skills/site-skill.md.
1
Sponsor

Label

An accessible label associated with a control.

Preview

Installation

$ pnpm dlx shadcn@latest add https://ui.ketyap.me/r/label.json

Usage

import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
 
<div className="grid gap-2">
  <Label htmlFor="email">Your email address</Label>
  <Input id="email" type="email" />
</div>;

Match htmlFor to the control's unique id. Clicking the label focuses or activates the associated control. For a disabled control, place it before the label with className="peer" to dim the label automatically.

Label in Field

For fields with descriptions and validation, use Base UI Field and its Field.Label, Field.Description, and Field.Error parts. See the Input field example.

API Reference

PropValuesDefault
htmlForAssociated control ID—
densitydefault, compactSizeProvider
renderBase UI render element or callbacklabel
classNamestring—

Accepts native label attributes and a ref. Preserve label semantics when using render. Text alignment follows the inherited direction, including RTL.