mirror of
https://github.com/hanzo-docs/docs.git
synced 2026-10-24 20:09:02 +00:00
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:
@@ -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}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user