Form label
The Label component renders a Bootstrap-styled form label and associates it with a form control using the htmlFor prop.
Import​
import { Form } from "@promethey/bsui";
Note
Labelinherits all utility props supported by thePrimecomponent, including spacing, typography, colors, positioning, and other Bootstrap utility APIs.
Basic usage​
Use htmlFor to associate the label with a form control. The value must match the id of the corresponding control.
Clicking the label focuses the associated control.
Form example​
Label can be used together with other BSUI form components to build consistent forms.
Required field​
Label does not provide validation behavior itself, but its content can include additional elements such as a required indicator.
Utility props​
Label inherits all utility props provided by Prime.
API​
Label​
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | — | Label content. |
htmlFor | string | — | Associates the label with a form control by its id. |
className | string | object | null | Additional class names applied to the label. |
style | object | null | Inline styles applied to the label. |
Label also supports all props provided by Prime.
Accessibility​
Always provide an htmlFor value that matches the id of the associated form control:
<Label htmlFor="email">Email</Label>
<Control id="email" type="email" />
This creates the native HTML association between the label and the control, allowing users to activate or focus the control by interacting with its label.