Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions apps/web/vibes/soul/form/radio-group/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Label } from '@/vibes/soul/form/label';
interface Option {
value: string;
label: string;
description?: string;
disabled?: boolean;
}

Expand Down Expand Up @@ -90,7 +91,9 @@ function RadioGroupItem({
return (
<div className="flex items-center" key={option.value}>
<RadioGroupPrimitive.Item
aria-label={option.label}
aria-labelledby={
option.description !== undefined ? `${id}-label ${id}-description` : `${id}-label`
}
className={clsx(
'size-5 cursor-default rounded-full border outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&:disabled+label]:pointer-events-none [&:disabled+label]:opacity-50',
{
Expand Down Expand Up @@ -126,15 +129,18 @@ function RadioGroupItem({
</RadioGroupPrimitive.Item>
<label
className={clsx(
'pl-3 text-sm leading-none',
'flex flex-grow justify-between pl-3 text-sm leading-none',
{
light: 'text-[var(--radio-group-light-label,hsl(var(--foreground)))]',
dark: 'text-[var(--radio-group-dark-label,hsl(var(--background)))]',
}[colorScheme],
)}
htmlFor={id}
>
{option.label}
<span id={`${id}-label`}>{option.label}</span>
{option.description !== undefined && (
<span id={`${id}-description`}>{option.description}</span>
)}
</label>
</div>
);
Expand Down
Loading