Skip to content

KRadioGroup

示例

Vertical

Selected: a

Horizontal

Radio button group with v-model binding, options array, and horizontal/vertical direction.

Props

NameTypeDefaultDescription
modelValuestringBound value via v-model (matches the selected option's value).
optionsArray<{ value: string; label: string; disabled?: boolean }>(required) Array of radio options.
direction'horizontal' | 'vertical''vertical'Layout direction of the radio options.
disabledbooleanfalseWhether the entire group is disabled. Individual options may also be disabled.
theme'auto' | 'day' | 'night''auto'Theme mode. auto follows the current theme; day and night force a specific mode.

Emits

NameParametersDescription
update:modelValue(value: string)Emitted when a radio option is selected.

Basic Usage

vue
<script setup>
import { ref } from 'vue'
import { KRadioGroup } from '@kK-2004/ui-component'

const selected = ref('option1')
</script>

<template>
  <KRadioGroup
    v-model="selected"
    :options="[
      { value: 'option1', label: 'Option 1' },
      { value: 'option2', label: 'Option 2' },
      { value: 'option3', label: 'Option 3', disabled: true },
    ]"
    direction="vertical"
  />
</template>