GooseUI

Components

Fade Scroller

New

Scroll container that fades the edge on the side where there is more to scroll, so users see that the content continues. The fade is a CSS mask driven by a scroll timeline, no JavaScript. Works horizontally and vertically. With a mouse the row scrolls with the wheel and the arrow buttons at the edges, with a trackpad or a finger by swipe, with the keyboard by the arrow keys after Tab. The wheel handler and the arrows are the only client part: a ref callback and a small island that calls scrollBy on click.

Browser Support

Scroll-driven animations

Animates elements while scrolling

Your browser:
Registered custom properties

Animates the fading edges

Your browser:
Masks

Creates fading edges

Your browser:
:has()

Styles the focused scroller

Your browser:
scripting media query

Adapts scrolling to JavaScript availability

Your browser:
scrollbar-width

Hides the scrollbar

Your browser:
overscroll-behavior

Contains scroll gestures

Your browser:

Preview

Scroll the table sideways: the left edge fades in, the right one fades out at the end. Scroll with the wheel or the arrows over a mouse, with a swipe on touch screens, or focus the table with Tab and use the arrow keys.

PlanPriceProjectsStorageMembersHistorySupportDomainsAPI calls
Starter$031 GB17 daysForum-1k / day
Team$122050 GB1090 daysEmail150k / day
Business$39Unlimited500 GB501 yearChat5500k / day
EnterpriseCustomUnlimitedCustomUnlimitedForeverManagerUnlimitedCustom

Installation

npx shadcn@latest add @gooseui/fade-scroller
pnpm dlx shadcn@latest add @gooseui/fade-scroller
yarn dlx shadcn@latest add @gooseui/fade-scroller
bunx --bun shadcn@latest add @gooseui/fade-scroller

Usage

import { FadeScroller } from "@/components/ui/fade-scroller"

export default function Example() {
  return (
    <FadeScroller label="Pricing table" className="rounded-lg border">
      <table className="w-full text-sm">{/* wide table */}</table>
    </FadeScroller>
  )
}

Examples

Row of chips

A wider fade and a hidden scrollbar suit tags and filters. Narrow the window to see the edges.

import { Button } from "@/components/ui/button"

<FadeScroller label="Topics" hideScrollbar fadeSize={56}>
  <div className="flex gap-2">
    {topics.map((topic) => (
      <Button key={topic} className="shrink-0 rounded-full border px-3">
        {topic}
      </Button>
    ))}
  </div>
</FadeScroller>

Vertical list

orientation="vertical" fades the top and bottom edges. The root needs a fixed height.

  • Deployed preview7 min ago
  • Merged pull request14 min ago
  • Opened issue21 min ago
  • Updated settings28 min ago
  • Invited member35 min ago
  • Rotated key42 min ago
  • Archived project49 min ago
  • Renamed branch56 min ago
  • Restored backup63 min ago
  • Changed plan70 min ago
  • Exported report77 min ago
  • Added domain84 min ago
<FadeScroller orientation="vertical" label="Activity" className="h-64">
  <ul className="divide-y">{/* items */}</ul>
</FadeScroller>

Arrow step

scrollStep sets how far one arrow click scrolls, as a share of the visible size. 1 turns the list page by page.

<FadeScroller
  orientation="vertical"
  label="Terms of service"
  scrollStep={1}
  className="h-80 rounded-lg border"
>
  <article className="prose p-4">{terms}</article>
</FadeScroller>

Props

PropTypeDefaultDescription
orientation"horizontal" | "vertical""horizontal"Scroll axis
fadeSizenumber40Width of the faded edge in px
showArrows"auto" | boolean"auto""auto" shows the arrows only on devices with a mouse and only when there is more to scroll, true shows them everywhere, false hides them
wheelbooleantrueThe vertical mouse wheel scrolls a horizontal row. Gives the wheel back to the page at the edges and leaves trackpads, Shift and Ctrl alone
scrollStepnumber0.8Arrow step as a fraction of the visible size
hideScrollbarbooleanfalseHide the native scrollbar
labelstring"Scrollable content"Name of the scroll region for screen readers
labelsPartial<FadeScrollerLabels>EnglishArrow button labels
viewportClassNamestring-Classes for the scrolling element
classNamestring-Classes for the root

Features

  • No JavaScript for the fades: a scroll timeline drives the mask, the browser does it off the main thread
  • Mask instead of overlay: the fade works on any background, no gradient color to match
  • Keyboard: the area always has tabIndex, role="region" and a label, so it scrolls with the arrow keys
  • Mouse, trackpad, keyboard: the wheel scrolls the row sideways, trackpads and touch work natively, the arrow keys scroll the focused area, no drag so clicks on the content stay intact
  • RTL: start and end follow the text direction
  • Reduced motion: arrow clicks scroll instantly instead of smoothly