# Radio ### Install ```js import Vue from 'vue'; import { RadioGroup, Radio } from 'vant'; Vue.use(Radio); Vue.use(RadioGroup); ``` ## Usage ### Basic Usage Use `v-model` to bind the name of checked radio ```html Radio 1 Radio 2 ``` ```js export default { data() { return { radio: '1', }; }, }; ``` ### Horizontal ```html Radio 1 Radio 2 ``` ### Disabled ```html Radio 1 Radio 2 ``` ### Custom Shape ```html Radio 1 Radio 2 ``` ### Custom Color ```html Radio 1 Radio 2 ``` ### Custom Icon Size ```html Radio 1 Radio 2 ``` ### Custom Icon Use icon slot to custom icon ```html Radio 1 Radio 2 > ``` ```js export default { data() { return { radio: '1', activeIcon: 'https://img.yzcdn.cn/vant/user-active.png', inactiveIcon: 'https://img.yzcdn.cn/vant/user-inactive.png', }; }, }; ``` ### Disable Label Click ```html Radio 1 Radio 2 ``` ### Inside a Cell ```html ``` ## API ### Radio Props | Attribute | Description | Type | Default | | --- | --- | --- | --- | | name | Radio name | _any_ | - | | shape | Can be set to `square` | _string_ | `round` | | disabled | Whether to disable radio | _boolean_ | `false` | | label-disabled | Whether to disable label click | _boolean_ | `false` | | label-position | Can be set to `left` | _string_ | `right` | | icon-size | Icon size | _number \| string_ | `20px` | | checked-color | Checked color | _string_ | `#1989fa` | - | ### RadioGroup Props | Attribute | Description | Type | Default | | --- | --- | --- | --- | | v-model (v-model) | Name of checked radio | _any_ | - | | disabled | Disable all radios | _boolean_ | `false` | | direction `v2.5.0` | Direction, can be set to `horizontal` | _string_ | `vertical` | | icon-size `v2.2.3` | Icon size of all radios | _number \| string_ | `20px` | | checked-color `v2.2.3` | Checked color of all radios | _string_ | `#1989fa` | - | ### Radio Events | Event | Description | Parameters | | ----- | -------------------------- | -------------- | | click | Triggered when click radio | _event: Event_ | ### RadioGroup Events | Event | Description | Parameters | | ------ | ---------------------------- | -------------- | | change | Triggered when value changed | _name: string_ | ### Radio Slots | Name | Description | SlotProps | | ------- | ------------ | ------------------ | | default | Custom label | - | | icon | Custom icon | _checked: boolean_ |