Control labels are used to identify form components such as FormControl
, Checkbox
, Password
and TextArea
. Best practice is to use this component as a child of FormGroup
.
Three sizes are supported: 'lg'
(the default), 'md'
and 'sm'
. Use the size
property to set the size.
Use the required
property to show visual indication with the label.
Property | Type | Default | Description |
---|---|---|---|
bsClass | String | 'control-label' | Base CSS class and prefix for the component. One should not generally change bsClass except to add new, non-Bootstrap CSS styles to a component. |
className | String | Any custom classes to add to the <label> element. | |
htmlFor | String | Sets the for attribute on the <label> element. If used within a FormGroup , the controlId property will be used. This property overrides that. | |
required | Boolean | false | Appends the required field indicator (red asterisk) to the end of the label text. |
size | String | 'lg' | Size of the <label> element. Options are 'lg' , 'md' , 'sm' . |
validationMessageState | String | If used in conjunction with field validation, this provides the icon next to the label. Options are 'error' , 'warning' . |