---
title: "Smooth Scroll"
description: "Free React smooth scroll provider built on Lenis, with a useSmoothScroll hook for offset, progress and velocity. Reduced-motion safe, shadcn install."
category: "Components"
parent: "https://beui.dev/components/motion/scroll-animation"
publishedAt: "2026-06-24"
updatedAt: "2026-11-10"
documentation: "https://beui.dev/components/motion/scroll-animation/smooth-scroll"
markdown: "https://beui.dev/components/motion/scroll-animation/smooth-scroll.md"
license: "MIT"
---

# Smooth Scroll

> Free React smooth scroll provider built on Lenis, with a useSmoothScroll hook for offset, progress and velocity. Reduced-motion safe, shadcn install.

## Install

```bash
npx shadcn@latest add @beui/smooth-scroll
```

## Dependencies

- `lenis`
- `lucide-react`
- `motion`
- `react`

## Usage

### Smooth Scroll usage

Smooth-scroll provider over Lenis with a useSmoothScroll hook exposing scroll offset, progress and velocity. Reduced-motion safe.

```tsx
"use client";

import { ArrowUp } from "lucide-react";

import { SmoothScroll, useSmoothScroll } from "@/components/motion/smooth-scroll";

// In production <SmoothScroll> wraps the page (root). Here it runs in contained
// mode (root={false}) so the box itself smooth-scrolls — the same engine, and
// the button uses the useSmoothScroll() hook to glide back to the top.
const SECTIONS = Array.from({ length: 16 }, (_, i) => i + 1);

function ScrollTopButton() {
  const { scrollTo } = useSmoothScroll();
  return (
    <button
      type="button"
      onClick={() => scrollTo(0)}
      className="sticky bottom-3 left-[calc(100%-3rem)] z-10 grid size-9 place-items-center rounded-full border border-border bg-background/80 text-foreground backdrop-blur transition-colors hover:bg-background"
      aria-label="Scroll to top"
    >
      <ArrowUp className="size-4" />
    </button>
  );
}

export function SmoothScrollPreview() {
  return (
    <SmoothScroll
      root={false}
      className="h-64 w-full max-w-lg overflow-y-auto scrollbar-hide rounded-2xl border border-border bg-card"
    >
      <div className="space-y-3 p-4">
        {SECTIONS.map((n) => (
          <div
            key={`section-${n}`}
            className="rounded-2xl bg-muted/60 px-3 py-4 text-sm text-muted-foreground"
          >
            Section {n}
          </div>
        ))}
      </div>
      <ScrollTopButton />
    </SmoothScroll>
  );
}
```

## API Reference

### SmoothScroll

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `root` | `boolean` | `true` | No | Drive the page (window) when true, or a contained scroll area when false. |
| `lerp` | `number` | `0.1` | No | Smoothing factor; lower is smoother and heavier. |
| `duration` | `number` | `1.2` | No | Wheel / programmatic ease duration in seconds. |
| `orientation` | `"horizontal" \| "vertical"` | `vertical` | No | Scroll axis that gets smoothed. Default: "vertical" |
| `wheelMultiplier` | `number` | `1` | No | Wheel scroll speed multiplier. |
| `touch` | `boolean` | `false` | No | Smooth touch scrolling. Off by default — native momentum is good on mobile. |
| `className` | `string` | — | No | Classes merged onto the wrapper element. |

## More in Scroll Animation

- [Scroll Progress](https://beui.dev/components/motion/scroll-animation/scroll-progress.md)
- [Parallax Scroll](https://beui.dev/components/motion/scroll-animation/parallax.md)
- [Scroll To Button](https://beui.dev/components/motion/scroll-animation/scroll-to.md)
- [Scroll Reveal](https://beui.dev/components/motion/scroll-animation/scroll-reveal.md)

## Source

- Registry detail: https://beui.dev/r/smooth-scroll
- Raw source: https://beui.dev/r/smooth-scroll/raw
- GitHub: https://github.com/starc007/ui-components
