Scroll Area
React layoutCustom scrollbar that always renders the same way across OSes (no flashing native scrollbars on Windows). Use for sidebars, dropdown content, and any overflow region you want to feel consistent.
Also available for Vue ->Installation
$ pnpm dlx shadcn@latest add https://react.uipkge.dev/r/react/scroll-area.json$ npx shadcn@latest add https://react.uipkge.dev/r/react/scroll-area.json$ yarn dlx shadcn@latest add https://react.uipkge.dev/r/react/scroll-area.json$ bunx shadcn@latest add https://react.uipkge.dev/r/react/scroll-area.json
Or with the named registry:
npx shadcn@latest add @uipkge-react/scroll-area
Examples
Dependencies
Used by
Files (2)
-
components/ui/scroll-area/scroll-area.tsx 1.9 kB
'use client' import * as React from 'react' import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area' import { cn } from '@/lib/utils' const ScrollArea = React.forwardRef< React.ElementRef<typeof ScrollAreaPrimitive.Root>, React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root> >(({ className, children, ...props }, ref) => ( <ScrollAreaPrimitive.Root ref={ref} data-uipkge="" data-slot="scroll-area" className={cn('relative', className)} {...props} > <ScrollAreaPrimitive.Viewport data-uipkge="" data-slot="scroll-area-viewport" className="focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1" > {children} </ScrollAreaPrimitive.Viewport> <ScrollBar /> <ScrollAreaPrimitive.Corner /> </ScrollAreaPrimitive.Root> )) ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName const ScrollBar = React.forwardRef< React.ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>, React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar> >(({ className, orientation = 'vertical', ...props }, ref) => ( <ScrollAreaPrimitive.ScrollAreaScrollbar ref={ref} data-uipkge="" data-slot="scroll-area-scrollbar" orientation={orientation} className={cn( 'flex touch-none p-px transition-colors select-none', orientation === 'vertical' && 'h-full w-2.5 border-l border-l-transparent', orientation === 'horizontal' && 'h-2.5 flex-col border-t border-t-transparent', className, )} {...props} > <ScrollAreaPrimitive.ScrollAreaThumb data-uipkge="" data-slot="scroll-area-thumb" className="bg-border relative flex-1 rounded-full" /> </ScrollAreaPrimitive.ScrollAreaScrollbar> )) ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName export { ScrollArea, ScrollBar } -
components/ui/scroll-area/index.ts 0.1 kB
export { ScrollArea, ScrollBar } from './scroll-area'
Raw manifest: https://react.uipkge.dev/r/react/scroll-area.json