1.0.1 • Published 10 months ago

@blur-ui/scroll-area v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Scroll Area

Augments native scroll functionality for custom, cross-browser styling. Optionally applies shadows when content overflows on scroll.

Live Examples

Features

  • Large-dependencies free.
  • Supports vertical, horizontal, and both orientations.
  • Fully unstyled and customizable.
  • RTL support.
  • Keyboard support.

Requirements

  • react >= 18.0.0

Installation

npm install @blur-ui/scroll-area

or

yarn add @blur-ui/scroll-area

Usage

const scrollAreaClassnames: ScrollAreaClassnames = {
  root: 'w-60 h-60',
  scrollbar: 'p-[1px]',
  verticalScrollbar: 'w-2.5',
  horizontalScrollbar: 'h-2.5',
  thumb: 'bg-neutral-100 rounded-full',
};

<ScrollArea classNames={scrollAreaClassnames}>
  <p>Lorem ...</p>
</ScrollArea>;

Props

ScrollArea

Prop NameTypeDefaultDescription
viewportPropsScrollAreaViewportPropsundefinedProps to pass to the viewport element, including a ref to the DOM element.
scrollbarPropsScrollAreaScrollbarPropsundefinedProps to customize the scrollbar.
verticalScrollbarPropsScrollAreaScrollbarPropsundefinedProps to customize the vertical scrollbar specifically.
horizontalScrollbarPropsScrollAreaScrollbarPropsundefinedProps to customize the horizontal scrollbar specifically.
thumbPropsScrollAreaThumbPropsundefinedProps to customize the scrollbar thumb.
verticalThumbPropsScrollAreaThumbPropsundefinedProps to customize the vertical scrollbar thumb specifically.
horizontalThumbPropsScrollAreaThumbPropsundefinedProps to customize the horizontal scrollbar thumb specifically.
cornerPropsScrollAreaCornerPropsundefinedProps to customize the scrollbar corner element.
classNamesScrollAreaClassNamesundefinedAn object to override default class names for various parts of the ScrollArea component.
disableShadowbooleanfalseIf true, disables the scroll shadow effect.
shadowSizenumber40The size of the shadow in pixels applied when content overflows.
orientation'vertical' \| 'horizontal' \| 'both''vertical'Determines the scroll orientation. Can be vertical, horizontal, or both.
refReact.Ref<HTMLDivElement>undefinedA ref to access the root DOM element of the ScrollArea.
childrenReact.ReactNodeundefinedThe content to be displayed within the ScrollArea.
offsetnumber0The offset used in calculating the scroll shadow visibility.
visibility'auto' \| 'visible' \| 'hidden''auto'Controls the visibility behavior of the scroll shadows.
onVisibilityChange(visible: boolean) => voidundefinedCallback function invoked when the visibility of the scroll shadows changes.

classNames Object

Class Name KeyDescription
rootClass name for the root ScrollArea element.
viewportClass name for the viewport area.
scrollbarClass name for the scrollbar container.
verticalScrollbarClass name for the vertical scrollbar.
horizontalScrollbarClass name for the horizontal scrollbar.
thumbClass name for the scrollbar thumbs.
verticalThumbClass name for the vertical scrollbar thumb.
horizontalThumbClass name for the horizontal scrollbar thumb.
cornerClass name for the scrollbar corner element.

Credits

Radix UI Scroll Area | Hero UI ScrollShadow

1.0.1

10 months ago

1.0.0

10 months ago