@@ -24,6 +24,11 @@ const props = defineProps<{
2424 * The value that should be assigned to the `modelValue` of the `NcRadioGroup`.
2525 */
2626 value: string
27+
28+ /**
29+ * Disabled state of the radio button
30+ */
31+ disabled? : boolean
2732}>()
2833
2934const labelId = createElementId ()
@@ -38,6 +43,10 @@ const isChecked = computed(() => radioGroup?.value.modelValue === props.value)
3843 * Handle updating the current model value
3944 */
4045function onUpdate() {
46+ if (props .disabled ) {
47+ return
48+ }
49+
4150 radioGroup ! .value .onUpdate (props .value )
4251}
4352 </script >
@@ -46,6 +55,7 @@ function onUpdate() {
4655 <div
4756 :class =" [{
4857 [$style.radioGroupButton_active]: isChecked,
58+ [$style.radioGroupButton_disabled]: disabled,
4959 }, $style.radioGroupButton, formBoxItemClass]"
5060 @click =" onUpdate" >
5161 <div v-if =" $scopedSlots.icon" :class =" $style.radioGroupButton__icon" >
@@ -63,6 +73,7 @@ function onUpdate() {
6373 class =" hidden-visually"
6474 :checked =" isChecked"
6575 type =" radio"
76+ :disabled =" disabled"
6677 :value =" value"
6778 @input =" onUpdate" >
6879 </div >
@@ -105,7 +116,7 @@ function onUpdate() {
105116 padding-inline-start : var (--radio-group-button--padding );
106117 }
107118
108- & :hover {
119+ & :hover:not ( .radioGroupButton_disabled ) {
109120 background-color : var (--radio-group-button--background-color-hover );
110121 }
111122
@@ -127,6 +138,17 @@ function onUpdate() {
127138 font-weight : bold ;
128139}
129140
141+ .radioGroupButton_disabled {
142+ filter : saturate ($opacity_normal );
143+ opacity : $opacity_disabled ;
144+
145+ // Reset the cursor
146+ cursor : default ;
147+ * {
148+ cursor : default ;
149+ }
150+ }
151+
130152.radioGroupButton__icon {
131153 --radio-group-button--icon-size : calc (var (--default-clickable-area ) - 4px );
132154 display : flex ;
0 commit comments