Radio
여러 선택지 가운데 하나만 고르게 해 주는 컴포넌트예요. 단독으로도 쓰이고 RadioGroup으로 묶어 옵션 배열에서 라디오를 만들 수도 있어요. 버튼 스타일 라디오도 함께 제공해요.
출처: 문서
본문
어릴 때 라디오를 듣는 걸 좋아했어요. FM 106.8이라든가 FM 92.1 같은요.
Demos
basic.vue
group.vue
options.vue
button-group.vue
size.vue
API
Radio Props, RadioButton Props
| 이름 | 타입 | 기본값 | 설명 | 버전 |
|---|---|---|---|---|
| checked | boolean |
undefined |
선택된 상태. | |
| default-checked | boolean |
false |
기본 선택 상태. | |
| disabled | boolean |
false |
비활성화 상태. | |
| label | string |
undefined |
라디오의 라벨. 설정하지 않으면 기본 슬롯 콘텐츠를 렌더해요. 둘 다 있으면 기본 슬롯 콘텐츠를 먼저 사용해요. | 2.28.0 |
| name | string |
undefined |
radio 요소의 name 속성. 설정하지 않으면 radio-group의 name을 사용해요. |
|
| size | 'small' | 'medium' | 'large' |
'medium' |
크기. | |
| value | string | number | boolean |
'on' |
선택 값. | boolean 2.33.0 |
| on-update:checked | (check: boolean) => void |
undefined |
선택이 바뀔 때 호출되는 콜백 메서드. |
RadioGroup Props
| 이름 | 타입 | 기본값 | 설명 | 버전 |
|---|---|---|---|---|
| disabled | boolean |
false |
비활성화 상태. | |
| default-value | string | number | boolean | null |
null |
기본 선택 값. | |
| label-field | string |
'label' |
options에서 옵션 라벨로 쓸 필드 이름. |
2.45.0 |
| name | string |
undefined |
그룹 안 radio 요소들의 name 속성. | |
| options | Array<{ label?: string, value: string | number | boolean, disabled?: boolean }> |
undefined |
라디오 그룹의 옵션. 설정하면 기본 슬롯은 무시돼요. | 2.45.0 |
| size | 'small' | 'medium' | 'large' |
'medium' |
크기. | |
| value | string | number | boolean | null |
null |
선택 값. | |
| value-field | string |
'value' |
options에서 옵션 값으로 쓸 필드 이름. |
2.45.0 |
| on-update:value | (value: string | number | boolean) => void |
undefined |
선택이 바뀔 때 호출되는 콜백 메서드. |
더 알아보기 (Learn more)
여러 개 중 여러 개를 고른다면 Checkbox 컴포넌트 문서를 참고하세요. 버튼 스타일 조합은 button-group 데모에서 확인할 수 있어요.