Label
A form label. htmlFor is the point — clicking it focuses the control, and a screen reader announces the two together.
src/components/ui/label.tsxAbout
From the component's own source, where it was written.
A form label. htmlFor is the point — clicking it focuses the control, and a screen reader announces the two together.
Install
npx astralyx-ui add label
Usage
import { Label } from '@/components/ui/label'
<Label htmlFor="email" required>Email</Label>
<Input id="email" type="email" />Composer
Change the props and the source below follows.
Props
tsx
<Label htmlFor="email">Email address</Label> <Input id="email" />
Examples
With a field
tsx
<Label htmlFor="email" required>Email</Label> <Input id="email" />
API
Generated from the source, so it cannot fall behind the code. One table per exported component, then hooks, functions and types.
Label
A form label. htmlFor is the point — clicking it focuses the control, and a screen reader announces the two together.
Extends ComponentProps<'label'>.
| Prop | Type | Default | Description |
|---|---|---|---|
| required | boolean | false | Appends a destructive asterisk, hidden from assistive tech since the control carries required itself. |
| htmlFor | string | — | Id of the control this labels. Without it the click-to-focus and the announcement are both lost. |