mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-15 18:01:24 +08:00
4560adfdf8
* refactor(style): adjust component size to large/default/small * refactor(components): avatar size & use flex instead of block * refactor(components): adjust check button size * refactor(components): adjust tag size * refactor(components): adjust size doc * fix(components): datetime-picker demo style width * refactor(components): color-picker size & block to flex * refactor(components): adjust slider input size * refactor(components): adjust radio input size for demo * refactor(components): adjust select size & docs * refactor(components): adjust form radio size & docs * refactor(components): add windicss for docs * refactor(components): adjust skeleton avatar size to css var * refactor(components): simplify typography size demo * refactor(components): adjust dropdown size & demo * refactor(components): adjust descriptions size * fix(components): datetime-picker showcase class pollute global button * chore(ci): upgrade docs dependencies to fix ci * fix(ci): add highlight because vitepress not export it * fix(ci): disable line for no-console * fix(ci): remove mini to fix test * fix(style): code font size * fix(style): button span flex style * fix(style): button padding horizontal default 15px * refactor(components): adjust tag padding size & demo * refactor(components): adjust form line-height for input * refactor(components): adjust dropdown menu size & button padding * fix(style): picker separator block to flex center * fix: dropdown button span items-center * style: adjust input-with-icon & size demo & fix input vitepress load * chore: upgrade dependencies * chore: upgrade dependencies * ci: fix website build * ci: regenerate pnpm-lock.yaml * ci: use dev pnpm-lock * ci: update pnpm-lock.yaml
116 lines
4.7 KiB
Markdown
116 lines
4.7 KiB
Markdown
---
|
|
title: Radio
|
|
lang: en-US
|
|
---
|
|
|
|
# Radio
|
|
|
|
Single selection among multiple options.
|
|
|
|
## Basic usage
|
|
|
|
Radio should not have too many options. Otherwise, use the Select component instead.
|
|
|
|
:::demo Creating a radio component is easy, you just need to bind a variable to Radio's `v-model`. It equals to the value of `label` of the chosen radio. The type of `label` is `String`, `Number` or `Boolean`.
|
|
|
|
radio/basic-usage
|
|
|
|
:::
|
|
|
|
## Disabled
|
|
|
|
`disabled` attribute is used to disable the radio.
|
|
|
|
:::demo You just need to add the `disabled` attribute.
|
|
|
|
radio/disabled
|
|
|
|
:::
|
|
|
|
## Radio button group
|
|
|
|
Suitable for choosing from some mutually exclusive options.
|
|
|
|
:::demo Combine `el-radio-group` with `el-radio` to display a radio group. Bind a variable with `v-model` of `el-radio-group` element and set label value in `el-radio`. It also provides `change` event with the current value as its parameter.
|
|
|
|
radio/radio-button-group
|
|
|
|
:::
|
|
|
|
## Button style
|
|
|
|
Radio with button styles.
|
|
|
|
:::demo You just need to change `el-radio` element into `el-radio-button` element. We also provide `size` attribute.
|
|
|
|
radio/button-style
|
|
|
|
:::
|
|
|
|
## With borders
|
|
|
|
:::demo The `border` attribute adds a border to Radios.
|
|
|
|
radio/with-borders
|
|
|
|
:::
|
|
|
|
## Radio Attributes
|
|
|
|
| Attribute | Description | Type | Accepted Values | Default |
|
|
| --------------------- | ------------------------------------ | ------------------------- | ---------------------- | ------- |
|
|
| model-value / v-model | binding value | string / number / boolean | — | — |
|
|
| label | the value of Radio | string / number / boolean | — | — |
|
|
| disabled | whether Radio is disabled | boolean | — | false |
|
|
| border | whether to add a border around Radio | boolean | — | false |
|
|
| size | size of the Radio | string | large / default /small | — |
|
|
| name | native 'name' attribute | string | — | — |
|
|
|
|
## Radio Events
|
|
|
|
| Event Name | Description | Parameters |
|
|
| ---------- | ------------------------------------- | ----------------------------------- |
|
|
| change | triggers when the bound value changes | the label value of the chosen radio |
|
|
|
|
## Radio Slots
|
|
|
|
| Name | Description |
|
|
| ---- | ------------------------- |
|
|
| — | customize default content |
|
|
|
|
## Radio-group Attributes
|
|
|
|
| Attribute | Description | Type | Accepted Values | Default |
|
|
| --------------------- | ------------------------------------------------- | ------------------------- | --------------------- | ------- |
|
|
| model-value / v-model | binding value | string / number / boolean | — | — |
|
|
| size | the size of radio | string | large / small / small | default |
|
|
| disabled | whether the nesting radios are disabled | boolean | — | false |
|
|
| text-color | font color when button is active | string | — | #ffffff |
|
|
| fill | border and background color when button is active | string | — | #409EFF |
|
|
|
|
## Radio-group Events
|
|
|
|
| Event Name | Description | Parameters |
|
|
| ---------- | ------------------------------------- | ----------------------------------- |
|
|
| change | triggers when the bound value changes | the label value of the chosen radio |
|
|
|
|
## Radio-group Slots
|
|
|
|
| Name | Description | Subtags |
|
|
| ---- | ------------------------- | -------------------- |
|
|
| — | customize default content | Radio / Radio-button |
|
|
|
|
## Radio-button Attributes
|
|
|
|
| Attribute | Description | Type | Accepted Values | Default |
|
|
| --------- | ------------------------- | --------------- | --------------- | ------- |
|
|
| label | the value of radio | string / number | — | — |
|
|
| disabled | whether radio is disabled | boolean | — | false |
|
|
| name | native 'name' attribute | string | — | — |
|
|
|
|
## Radio-button Slots
|
|
|
|
| Name | Description |
|
|
| ---- | ------------------------- |
|
|
| — | customize default content |
|