UNPKG

1.63 kBTypeScriptView Raw
1import { ComponentType } from 'react'
2import { StandardProps } from './common'
3interface LabelProps extends StandardProps {
4 /** 绑定控件的 id
5 * @supported weapp, alipay, swan, tt, qq, jd, h5
6 */
7 for?: string
8}
9/** 用来改进表单组件的可用性。
10 *
11 * 使用for属性找到对应的id,或者将控件放在该标签下,当点击时,就会触发对应的控件。 for优先级高于内部控件,内部有多个控件的时候默认触发第一个控件。 目前可以绑定的控件有:button, checkbox, radio, switch。
12 * @classification forms
13 * @supported weapp, swan, alipay, tt, h5, rn, harmony
14 * @example_react
15 * ```tsx
16 * class App extends Components {
17 *
18 * render () {
19 * return (
20 * <RadioGroup>
21 * <Label className='example-body__label' for='1' key='1'>
22 * <Radio value='USA'>USA</Radio>
23 * </Label>
24 * <Label className='example-body__label' for='2' key='2'>
25 * <Radio value='CHN' checked>
26 * CHN
27 * </Radio>
28 * </Label>
29 * </RadioGroup>
30 * )
31 * }
32 * }
33 * ```
34 * @example_vue
35 * ```html
36 * <template>
37 * <radio-group>
38 * <label class="example-body__label" for="1" key="1">
39 * <radio id="1" value="USA" />
40 * USA
41 * </label>
42 * <label class="example-body__label" for="2" key="2">
43 * <radio id="2" value="CHN" :checked="true" />
44 * CHN
45 * </label>
46 * </radio-group>
47 * </template>
48 * ```
49 * @see https://developers.weixin.qq.com/miniprogram/dev/component/label.html
50 */
51declare const Label: ComponentType<LabelProps>
52export { Label, LabelProps }