A separator's class can be a function of its state

Base UI passes component state to className when the caller gives it a
function. SelectSeparator handed that argument straight to cn(), which
takes class values, so a function className would have been stringified
into the class list. Takes the state form tabs.tsx already uses.
This commit is contained in:
zooqueen
2026-08-27 15:45:00 -07:00
parent ec6caecf93
commit 3af1fc62f7
+11 -1
View File
@@ -108,5 +108,15 @@ export function SelectItem({
}
export function SelectSeparator({ className, ...props }: ComponentProps<typeof Separator>) {
return <Separator className={cn('mx-1 my-1 h-px bg-fd-border', className)} {...props} />;
return (
<Separator
className={(state) =>
cn(
'mx-1 my-1 h-px bg-fd-border',
typeof className === 'function' ? className(state) : className,
)
}
{...props}
/>
);
}