Skip to content
Eskais UI

Layout

Scroll Area

ScrollArea: native scrolling with styled scrollbars, edge state and follow-to-end, keyboard-reachable when it overflows. Its own primitive, written for speed from UI SDK's.

Example

  • Run #1240
  • Run #1241
  • Run #1242
  • Run #1243
  • Run #1244
  • Run #1245
  • Run #1246
  • Run #1247
  • Run #1248
  • Run #1249
  • Run #1250
  • Run #1251
  • Run #1252
  • Run #1253
  • Run #1254
  • Run #1255
  • Run #1256
  • Run #1257
  • Run #1258
  • Run #1259

Installation

npx shadcn@latest add @eskais/scroll-area
Brings alongnarrow

Usage

Import
import {  createScrollAreaController,  ScrollArea,  ScrollAreaContent,  ScrollAreaCorner,  ScrollAreaScrollbar,  ScrollAreaScrollToEnd,  ScrollAreaThumb,  ScrollAreaViewport,} from "@/components/ui/scroll-area"import { createScrollAreaController, scrollArea } from "@/components/ui/scroll-area-primitive"import { createScrollView } from "@/components/ui/scroll-area-view"import {  createStyleWriter,  draggedPosition,  listen,  edgeTolerance,  edgesOf,  focusViewport,  isEditing,  mainAxis,  maxScroll,  names,  overflows,  pageDirection,  pageFraction,  positionAt,  prefersReducedMotion,  registerFrameVariables,  scaleOf,  scrollbarShown,  scrollsInside,  startwardKeys,  thumbGeometry,  trackPoint,  wheelPixels,} from "@/components/ui/scroll-area-model"import { createScrollbarInput } from "@/components/ui/scroll-area-pointer"import { bindTabStop } from "@/components/ui/scroll-area-tab-stop"import { layersBesideViewport, windowScroller } from "@/components/ui/scroll-area-layers"

API reference

ScrollArea

Takes ComponentProps.

ScrollAreaViewport

Takes ComponentProps.

ScrollAreaContent

Takes ComponentProps.

ScrollAreaCorner

Takes ComponentProps.

ScrollAreaScrollToEnd

Takes ComponentProps.

ScrollAreaScrollbar

PropTypeDefault
orientationOrientation"vertical"

Also takes PartProps.

ScrollAreaThumb

Takes PartProps.

Other exports

createScrollAreaControllerscrollAreacreateScrollViewcreateStyleWriterdraggedPositionlistenedgeToleranceedgesOffocusViewportisEditingmainAxismaxScrollnamesoverflowspageDirectionpageFractionpositionAtprefersReducedMotionregisterFrameVariablesscaleOfscrollbarShownscrollsInsidestartwardKeysthumbGeometrytrackPointwheelPixelscreateScrollbarInputbindTabStoplayersBesideViewportwindowScrollertype Orientationtype ScrollAreaControllertype ScrollAreaOptionstype ScrollAreaScrollbarStatetype ScrollAreaThumbStatetype Axistype Metricstype ScrollAreaModeltype ScrollAreaScrollOptionstype ScrollAreaStoretype ScrollAreaTypetype ScrollViewQueries

Accessibility

  • Native scrolling, so keyboard, wheel and touch work; name a focusable viewport when it holds content.
  • An overflowing viewport with nothing focusable inside is a tab stop, so keyboard users can reach it.

Agent actions

Agents scroll it to its start or end (scrollToStart, scrollToEnd).

Runs agent.snapshot() from @ui-sdk/react/agent on the live preview above.