scroll-area.tsx
This file
Path
apps/web/src/components/ui/scroll-area.tsx
54 lines · 1.6 KiB · TypeScript
Last changed by
Give the web its W9 dependencies, components, project nav, line and revision helpers, and a stub for every new pageoscabrielbefore adoption254268a
History of this fileTake it
Give the web its W9 dependencies, components, project nav, line and revision helpers, and a stub for every new pageoscabrielbefore adoption254268a
lines 1–54why, one step back1"use client";23import { ScrollArea as ScrollAreaPrimitive } from "@base-ui/react/scroll-area";4import { cn } from "cn";5import * as React from "react";67function ScrollArea({8 className,9 children,10 ...props11}: ScrollAreaPrimitive.Root.Props) {12 return (13 <ScrollAreaPrimitive.Root14 data-slot="scroll-area"15 className={cn("relative", className)}16 {...props}17 >18 <ScrollAreaPrimitive.Viewport19 data-slot="scroll-area-viewport"20 className="focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1"21 >22 {children}23 </ScrollAreaPrimitive.Viewport>24 <ScrollBar />25 <ScrollAreaPrimitive.Corner />26 </ScrollAreaPrimitive.Root>27 );28}2930function ScrollBar({31 className,32 orientation = "vertical",33 ...props34}: ScrollAreaPrimitive.Scrollbar.Props) {35 return (36 <ScrollAreaPrimitive.Scrollbar37 data-slot="scroll-area-scrollbar"38 data-orientation={orientation}39 orientation={orientation}40 className={cn(41 "flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent",42 className43 )}44 {...props}45 >46 <ScrollAreaPrimitive.Thumb47 data-slot="scroll-area-thumb"48 className="bg-border relative flex-1 rounded-none"49 />50 </ScrollAreaPrimitive.Scrollbar>51 );52}5354export { ScrollArea, ScrollBar };