npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@present-day/scroll-area

v0.1.1

Published

A Radix or Base UI scroll area with theme-aware edge fades and shadows

Readme

@present-day/scroll-area

A Radix or Base UI scroll area that shows where more content is hidden, using an edge fade or a theme-aware shadow. It supports light and dark mode, RTL, and never re-renders while scrolling.

▶ Try it in Storybook

Install it with the primitive library you use. Both are optional peer dependencies:

bun add @present-day/scroll-area @radix-ui/react-scroll-area
# or
bun add @present-day/scroll-area @base-ui/react
import { ScrollArea } from '@present-day/scroll-area'         // Radix (also '/radix')
import { ScrollArea } from '@present-day/scroll-area/base-ui' // Base UI

<div style={{ height: 320 }}>
  <ScrollArea edgeEffect="shadow">{items}</ScrollArea>
</div>

Both adapters take the same props and produce the same DOM contract, so switching is an import change. Styles load automatically with either entry. To load them yourself instead, import @present-day/scroll-area/styles.css.

Props

| Prop | Type | Default | | | --- | --- | --- | --- | | axis | "vertical" \| "horizontal" \| "both" | "vertical" | Which directions scroll | | edgeEffect | "fade" \| "shadow" \| "none" | "fade" | How hidden content is signaled | | edgeSize | number \| string | 24px (token) | Depth of the edge effect; numbers are px | | scrollbars | "hover" \| "scroll" \| "auto" \| "always" \| "hidden" | "hover" | When scrollbars show; "hidden" still scrolls | | dir | "ltr" \| "rtl" | inherited | Reading direction | | classNames | { root, viewport, scrollbar, thumb } | | Classes for internal parts (Base UI adds content) | | viewportRef | Ref<HTMLDivElement> | | The scrolling element (object or callback ref) | | ref | Ref<HTMLDivElement> | | The root element |

Every other Root prop of the underlying library passes through. That includes scrollHideDelay and asChild for Radix, and render and overflowEdgeThreshold for Base UI.

Option objects

Every union prop also has an as const object in SCREAMING_SNAKE_CASE, next to its PascalCase type. Either form works:

import { SCROLL_AREA_EDGE_EFFECT, ScrollArea } from '@present-day/scroll-area'

<ScrollArea edgeEffect={SCROLL_AREA_EDGE_EFFECT.SHADOW} />
<ScrollArea edgeEffect="shadow" />

| Object | Type | | --- | --- | | SCROLL_AREA_AXIS | ScrollAreaAxis | | SCROLL_AREA_EDGE_EFFECT | ScrollAreaEdgeEffect | | SCROLL_AREA_SCROLLBARS | ScrollAreaScrollbars |

Object.values(...) lists the allowed values.

Adapter differences

| | Radix | Base UI | | --- | --- | --- | | Composition | asChild | render | | Content wrapper | hidden display: table div | Content part (classNames.content) | | scrollbar="hover" \| "scroll" | handled by Radix (scrollHideDelay) | CSS, keyed off Base UI's data-hovering / data-scrolling | | RTL | dir attribute | dir attribute plus a DirectionProvider when dir is set | | Keyboard | viewport not focusable | viewport focusable while it overflows |

Edge effects

  • fade masks the content itself, so it blends into any background with no color setup.
  • shadow draws --scroll-area-shadow-color over the edge. Use it when content should stay fully opaque.
  • none draws nothing.

The root always carries data-overflow-top|right|bottom|left attributes for your own styling. It also carries data-edge-effect, data-scrollbars, and data-primitive (radix or base-ui).

Theming

Colors use light-dark() and follow the inherited color-scheme. The package never sets color-scheme itself:

:root { color-scheme: light dark; }        /* follow the OS */
[data-theme="dark"] { color-scheme: dark; } /* or force a mode */

If your bundler's CSS targets predate light-dark() (Vite's default build.cssTarget does), Lightning CSS rewrites it into a var() polyfill that only works when color-scheme is declared in CSS, as above. Setting color-scheme only from JavaScript or a <meta> tag leaves the polyfill undefined and the colors invalid. Either declare it in CSS or raise the targets to chrome123, firefox120, and safari17.5.

Override these tokens on any ancestor:

| Token | Default | | --- | --- | | --scroll-area-edge-size | 24px | | --scroll-area-edge-fade-min | transparent | | --scroll-area-shadow-color | light-dark(rgb(0 0 0 / .16), rgb(0 0 0 / .6)) | | --scroll-area-thumb-color | light-dark(rgb(0 0 0 / .28), rgb(255 255 255 / .28)) | | --scroll-area-thumb-color-hover | light-dark(rgb(0 0 0 / .45), rgb(255 255 255 / .45)) | | --scroll-area-thumb-size | 6px | | --scroll-area-touch-target | 24px | | --scroll-area-content-display | table (Radix) / block (Base UI) |

Building blocks

useScrollEdges(targetRef, { horizontal, vertical }) returns a callback ref for any scrolling element and mirrors its edges as data-overflow-* on the target. Each entry also exports its parts (Root, Viewport, Scrollbar, Thumb, Corner, and Content for Base UI) with the sa- classes applied, plus mergeRefs, for custom layouts.

Development

bun run storybook   # http://localhost:6006 (toolbar: Theme, Adapter)
bun run test
bun run build