Radio Radio
Register a selectable option in a radio group.
Import
Use <hui-radio> with uni-app easycom. Import public types from @nscode/handy-uni. For ordinary Vue 3, install the preview plugin from @nscode/handy-uni/web and register its components.
Examples
Interact with the controls to see values and event results on the page.
vue
<template>
<view>
<hui-radio-group v-model="value"
><hui-radio value="a" label="选项 A / Option A" />
<hui-radio value="b" label="选项 B / Option B" /><hui-radio
value="c"
disabled
label="禁用 / Disabled" /></hui-radio-group
><text>{{ value }}</text>
<text>{{ lastEvent }}</text>
</view>
</template>
<script setup lang="ts">
import { ref } from 'vue'
const lastEvent = ref('No event yet')
const value = ref<string | number | boolean | null>('a')
</script>
Props
| Prop | Type | Default | Description |
|---|---|---|---|
value | ChoiceValue | undefined | Option value or displayed value. |
label | string | — | Visible label. |
disabled | boolean | false | Disable interaction. |
readonly | boolean | undefined | Read-only presentation without value changes. |
shape | "round" | "check" | — | Selection indicator shape. |
iconPosition | "left" | "right" | — | Icon position relative to the label. |
size | ComponentSize | — | Component size; inherits configuration when omitted. |
Root attributes: common props. A Boolean default of undefined supports inheritance; explicit false overrides it. Other Boolean props default to false unless listed otherwise.
Events
None.
Slots
| Slot | Parameters | Description |
|---|---|---|
icon | { checked, indeterminate, disabled } | Custom icon region; replaces its fallback content. |
default | — | Main content. |
Methods
None.
Types
RadioProps are available from @nscode/handy-uni.
ts
export type RadioValue = ChoiceValue
Platform notes
| Behavior | uni-app H5 | WeChat Mini Program | App-vue | Ordinary Vue 3 Web (preview) |
|---|---|---|---|---|
| Basic interaction | Supported; device checks pending | Supported; device checks pending | Supported; device checks pending | Supported by the web platform adapter |
Follow the smoke checklist. Device evidence is tracked separately; unit tests do not establish device acceptance.