Patternmode

ScrollFrame

Base UI-backed scroll frames with reliable plumbing, eased edge fades, hidden or visible scrollbars, and overflow-aware movement controls.

Install

npm install @patternmode/scrollframe
import { ScrollFrame } from "@patternmode/scrollframe";
import "@patternmode/scrollframe/styles.css";

function MaterialStrip() {
  return (
    <ScrollFrame
      aria-label="Materials"
      axes="horizontal"
      dragScroll
      fadeColor="var(--surface)"
      scrollbars="hidden"
    >
      {materials.map((material) => (
        <Tag key={material}>{material}</Tag>
      ))}
    </ScrollFrame>
  );
}

Core API

ScrollFrame

Base UI-backed scroll container with measured fades and movement controls.

axes
"vertical" | "horizontal" | "both""vertical"Chooses the supported scroll axes.
fades
boolean | "none" | "start" | "end" | "both" | AxisFadeConfigtrueControls measured eased edge fades.
fadeColor
stringCSS color used by the fade overlays.
fadeSize
number | stringSize of the fade overlay along the scroll axis.
scrollbars
"auto" | "always" | "hover" | "hidden""auto"Controls scrollbar visibility; hidden and always keep the scroll plumbing mounted.
controls
boolean | ScrollFrameControlsConfigfalseAdds overflow-aware previous and next movement controls.
dragScroll
boolean | ScrollFrameDragScrollConfigfalseEnables pointer drag scrolling while preserving native scroll and text selection until a drag threshold is crossed.
scrollStep
"page" | number | ((state, axis) => number)"page"Controls movement distance for previous and next controls.