Label
Component Features
- 🔗 Form Association: Associates labels with form controls for proper ARIA attributes.
- 📏 Multiple Sizes: Supports
xs,sm,md,lg,xl,2xlsize specs. - ✨ Required Indicator: Supports
requiredprop to display required asterisk. - 🚫 Disabled State: Supports
disabledprop for disabled labels. - ↕️ Alignment: Supports
left,right,toplabel alignment. - 🎨 Theme Customization: Based on
BrConfigProviderfor global theming and TailwindCSS local overrides.
Basic Usage
Form Association
The Label component is associated with form controls via the for attribute. Clicking the label automatically focuses the corresponding control.
Required Indicator
Use the required prop to show a required indicator (red asterisk) next to the label.
Disabled State
Use the disabled prop to set the label to a disabled state, reducing opacity and changing the cursor style.
Sizes
Use the size prop to control the size of the label.
Theming
Global Configuration (BrConfigProvider)
You can globally configure the basic styles of Label, such as font color and border radius, via BrConfigProvider.
Local Override (TailwindCSS)
You can directly override default styles using TailwindCSS classes via the class prop.
Dark Mode
BrLabel supports dark mode toggling via BrConfigProvider or the dark class.