From 0c8ab9d98e494c49cceac111edc0606ee4d63638 Mon Sep 17 00:00:00 2001 From: Benjamin Canac Date: Sat, 16 Dec 2023 00:12:40 +0100 Subject: [PATCH] fix(RadioGroup): pass `option.disabled` to children Fixes #1109 --- docs/content/3.forms/6.radio-group.md | 4 ++-- src/runtime/components/forms/RadioGroup.vue | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/content/3.forms/6.radio-group.md b/docs/content/3.forms/6.radio-group.md index 647cbf6b60..e8cbc7b5d0 100644 --- a/docs/content/3.forms/6.radio-group.md +++ b/docs/content/3.forms/6.radio-group.md @@ -60,7 +60,7 @@ Use the `disabled` prop to disable the RadioGroup. ::component-card --- baseProps: - options: [{ value: 'email', label: 'Email' }, { value: 'sms', label: 'Phone (SMS)' }, { value: 'push', label: 'Push notification' }] + options: [{ value: 'email', label: 'Email' }, { value: 'sms', label: 'Phone (SMS)' }, { value: 'push', label: 'Push notification', disabled: true }] modelValue: 'sms' props: disabled: true @@ -68,7 +68,7 @@ props: :: ::callout{icon="i-heroicons-light-bulb"} -This prop also work on the Radio component. +This prop also work on the Radio component and you can set the `disabled` field in the `options` to disable a specific Radio. :: ### Label diff --git a/src/runtime/components/forms/RadioGroup.vue b/src/runtime/components/forms/RadioGroup.vue index c0cda3fcec..880c7f32a1 100644 --- a/src/runtime/components/forms/RadioGroup.vue +++ b/src/runtime/components/forms/RadioGroup.vue @@ -12,7 +12,7 @@ :label="option.label" :model-value="modelValue" :value="option.value" - :disabled="disabled" + :disabled="option.disabled || disabled" :ui="uiRadio" @change="onUpdate(option.value)" >