Basic usage
Props
'small' | 'medium' | 'large'
default:"'small'"
Size of the label text.
boolean
default:"false"
Whether to display a required field indicator.
string
default:"'*'"
The character or text to display for required fields.
string
The ID of the form control this label is associated with.
string
Additional CSS classes to apply.
ReactNode
The label text content.
Required fields
Indicate required fields with an asterisk or custom indicator.Custom required indicator
Sizes
Three size options for different form layouts.Complete form field
With checkbox
With radio buttons
Accessibility
- Always use the
htmlForprop to associate labels with their form controls - The required indicator includes
aria-hidden="true"androle="presentation"to prevent redundant screen reader announcements - Ensure the associated input has the
requiredattribute when using the required indicator - Use clear, descriptive label text that explains the purpose of the form control
Related components
- InputField - Text input component with built-in label support
- Checkbox - Checkbox component with label support
- Radio - Radio button component