Skip to main content
Version: Next

Label

Improves the availability of form components.

You can use the for property to find the appropriate ID. Alternatively, you can place the control within this tag, so that you can tap the tag to trigger the corresponding control. The for property takes precedence over internal controls. When multiple internal controls are available, the first control is triggered by default. The following controls can be bound to this component: button, checkbox, radio, and switch.

Reference

Type

ComponentType<LabelProps>

Examples

class App extends Components {

render () {
return (
<RadioGroup>
<Label className='example-body__label' for='1' key='1'>
<Radio id='1' value='USA'>USA</Radio>
</Label>
<Label className='example-body__label' for='2' key='2'>
<Radio id='2' value='CHN' checked>
CHN
</Radio>
</Label>
</RadioGroup>
)
}
}

LabelProps

PropertyTypeRequiredDescription
forstringNoThe ID of the bound control, not supported in RN

API Support

APIWeChat Mini-ProgramBaidu Smart-ProgramAlipay Mini-ProgramByteDance Micro-AppH5React Native
Label✔️✔️✔️✔️✔️✔️