Introducing PrimeReact v11-alpha 🎉Discover Now

Label

Label provides accessible text labels for form controls. Use `htmlFor` to link the label to a form control by its id.

preview

Installation#

npx shadcn@latest add @primereact/label

Usage#

import { Label } from '@/components/ui/label';
<Label htmlFor="username">Username</Label>

Examples#

Basic#

An accessible label element associated with a form control.

basic-demo

Required#

You can display required indicators in the label content while keeping the input semantics with required or aria-required.

required-demo

Accessibility#

Screen Reader#

Label renders a native label element. Use htmlFor to associate it with a form control id, or wrap the form control inside the label.

Keyboard Support#

Component does not include any interactive elements.