'use client';
import { ScrollArea as ScrollAreaPrimitive } from '@base-ui/react/scroll-area';
import { cn } from '@/lib/utils';
type ScrollAreaProps = ScrollAreaPrimitive.Root.Props & {
scrollbars?: 'vertical' | 'horizontal' | 'both';
};
function ScrollArea({ className, children, scrollbars = 'vertical', ...props }: ScrollAreaProps) {
const hasHorizontalScrollbar = scrollbars === 'horizontal' || scrollbars === 'both';
return (
{children}
{scrollbars !== 'horizontal' && }
{hasHorizontalScrollbar && }
);
}
function ScrollBar({
className,
orientation = 'vertical',
...props
}: ScrollAreaPrimitive.Scrollbar.Props) {
return (
);
}
export { ScrollArea, type ScrollAreaProps, ScrollBar };