2020-08-13 11:47:56 +08:00
# Radio
## Demos
### Sizes
2021-10-20 01:11:27 +08:00
Available size variant for the [`ui` ](#props-ui ) prop: `s` / `m` .
2020-08-13 11:47:56 +08:00
[[ demo src="/demo/radio/size.vue" ]]
### Setting value
2021-10-20 01:11:27 +08:00
Use the [`value` ](#props-value ) prop to specify the value bound to `v-model` .
2020-08-13 11:47:56 +08:00
[[ demo src="/demo/radio/model.vue" ]]
## API
### Props
| Name | Type | Default | Description |
| -- | -- | -- | -- |
2021-10-20 01:11:27 +08:00
| ``ui`` | `string=` | - | [^ui] |
| ``checked`` | `boolean` | `false` | [^checked] |
| ``value`` | `*` | `true` | The value of the radio. |
| ``disabled`` | `boolean=` | `false` | Whether the radio is disabled. |
| ``readonly`` | `boolean=` | `false` | Whether the radio is read-only. |
2020-08-13 11:47:56 +08:00
^^^ui
Style variants.
+++Enum values
| Value | Description |
| -- | -- |
| `s` | Small. |
| `m` | Medium. |
+++
^^^
^^^checked
:::badges
`.sync`
:::
Whether the checkbox is checked.
^^^
### Slots
| Name | Description |
| -- | -- |
2021-10-20 01:11:27 +08:00
| ``default`` | The label text of the radio. The radio is selected when the label is clicked. Displays nothing by default. |
2020-08-13 11:47:56 +08:00
### Events
| Name | Description |
| -- | -- |
2021-10-20 01:11:27 +08:00
| ``change`` | Triggered when user checks the radio. The callback parameter list is `(checked: boolean)` . `checked` denotes whether the radio is checked. |
| ``input`` | [^event-input] |
2020-08-13 11:47:56 +08:00
^^^event-input
:::badges
`v-model`
:::
2021-10-20 01:11:27 +08:00
Triggered when the check state is changed. The callback parameter list is `(val: *)` , with `val` being the current value of `v-model` . Unlike the [`change` ](#events-change ) event, `input` is triggered even without user interaction.
2020-08-13 11:47:56 +08:00
^^^
Additionally, `Radio` exposes the following native events:
`auxclick` , `click` , `contextmenu` , `dblclick` , `mousedown` , `mouseenter` , `mouseleave` , `mousemove` , `mouseover` , `mouseout` , `mouseup` , `select` , `wheel` , `keydown` , `keypress` , `keyup` , `focus` , `blur` , `focusin` , `focusout` .
The callback parameter is the corresponding native event object for all events above.