mirror of
https://github.com/lc-soft/LCUI.git
synced 2026-11-30 16:48:21 +01:00
25 lines
666 B
Plaintext
25 lines
666 B
Plaintext
# Label
|
|
|
|
Renders an accessible label associated with controls. Click events are forwarded to the target widget referenced by the `for` attribute.
|
|
|
|
<WidgetExample name="label-basic" />
|
|
|
|
## Use cases
|
|
|
|
- **Suitable**: extending the clickable area of interactive widgets such as checkbox and text-input so that clicking the label text also triggers the widget.
|
|
- **Suitable**: associating text with a control for accessibility (a11y).
|
|
- **Not suitable**: purely decorative text display (use the `text` widget instead).
|
|
|
|
## Usage
|
|
|
|
```tsx
|
|
import { Label } from "@lcui/react"
|
|
```
|
|
|
|
```tsx
|
|
<Label for="agree">I agree</Label>
|
|
```
|
|
|
|
## API Reference
|
|
|
|
<FieldTable name="label" /> |