Skip to content

Commit 4938b8e

Browse files
authored
[6.x] Radio items can now be disabled (#12319)
Radio items can now be disabled
1 parent c9973e9 commit 4938b8e

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

resources/js/components/ui/Radio/Item.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ const id = useId();
1616
<RadioGroupItem
1717
:id
1818
:value="value"
19+
:disabled
1920
class="
2021
shadow-ui-xs mt-0.5 size-4 cursor-default rounded-full
2122
focus:focus-outline border border-gray-400/75 dark:border-none bg-white outline-hidden
22-
data-[state=checked]:border-ui-accent
23+
data-[state=checked]:border-ui-accent data-[disabled]:opacity-50
2324
dark:bg-gray-400 dark:data-[state=checked]:border-none dark:data-[state=checked]:bg-gray-300
2425
"
2526
>
@@ -31,7 +32,7 @@ const id = useId();
3132
"
3233
/>
3334
</RadioGroupItem>
34-
<label class="flex flex-col" :for="id">
35+
<label class="flex flex-col" :class="{ 'opacity-50': disabled }" :for="id">
3536
<span class="text-sm font-normal text-gray-600 antialiased dark:text-gray-200">
3637
<slot>{{ label || value }}</slot>
3738
</span>

resources/views/playground.blade.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,18 @@
222222
</div>
223223
</section>
224224

225+
<section class="space-y-4">
226+
<ui-heading size="lg">Disabled Radio Items</ui-heading>
227+
<ui-radio-group name="favorite" label="Choose your favorite Star Wars movie">
228+
<ui-radio-item label="A New Hope" value="ep4"/>
229+
<ui-radio-item label="Empire Strikes Back" value="ep5" />
230+
<ui-radio-item label="Return of the Jedi" value="ep6" />
231+
<ui-radio-item disabled label="the Force Awakens" value="ep7" />
232+
<ui-radio-item disabled label="The Last Jedi" value="ep8" />
233+
<ui-radio-item disabled label="The Rise of Skywalker" value="ep9" />
234+
</ui-radio-group>
235+
</section>
236+
225237
<section class="space-y-4">
226238
<ui-heading size="lg">Select</ui-heading>
227239
<div class="flex">

0 commit comments

Comments
 (0)