UNPKG

smooth-motion

Version:

React smooth scroll and animation component powered by Framer Motion. Lightweight, fluid, customizable, TypeScript-ready, and perfect for modern web apps and UI design.

129 lines (90 loc) โ€ข 3.38 kB
# smooth-motion [![npm version](https://img.shields.io/npm/v/smooth-motion.svg)](https://www.npmjs.com/package/smooth-motion) [![npm downloads](https://img.shields.io/npm/dm/smooth-motion.svg)](https://www.npmjs.com/package/smooth-motion) [![TypeScript](https://img.shields.io/badge/TypeScript-ready-blue.svg)](https://www.typescriptlang.org/) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) **Author:** Thinakaran Manokaran ยท [https://thinakaran.dev](https://thinakaran.dev) --- ## ๐ŸŒŸ Overview **smooth-motion** is a **lightweight React smooth scroll component** powered by **Lenis**. It enables **fluid, speed-controllable scroll effects** with zero external CSS, working seamlessly in both **JavaScript (JSX)** and **TypeScript (TSX)** projects. Ideal for **modern UI/UX**, landing pages, portfolios, and apps that need **silky smooth scrolling animations** with minimal setup. --- ## โœจ Features * ๐Ÿš€ Smooth **Lenis-powered scroll animations** * โšก **Lightweight** and dependency-friendly * ๐Ÿ”ง Fully **customizable** via props (`speed`) * ๐Ÿ“ฆ Out-of-the-box support for **JSX & TSX** * ๐ŸŽจ No extra CSS โ€” just clean, declarative **React** * ๐Ÿ›ก๏ธ TypeScript typings included --- ## ๐Ÿ“ฆ Installation Install with your favorite package manager: ```bash npm install smooth-motion # or yarn add smooth-motion # or pnpm add smooth-motion ``` --- ## ๐Ÿš€ Usage Examples ### JavaScript (JSX) ```jsx import React from "react"; import { UseSmoothScroll } from "smooth-motion"; export default function App() { return ( <> <UseSmoothScroll speed={1.5} /> <div style={{ height: 3000 }}> <h1>Hello from UseSmoothScroll (JSX)</h1> </div> </> ); } ``` ### TypeScript (TSX) ```tsx import React from "react"; import { UseSmoothScroll } from "smooth-motion"; const App: React.FC = () => { return ( <> <UseSmoothScroll speed={2} /> <div style={{ height: 3000 }}> <h1>Hello from UseSmoothScroll (TSX)</h1> </div> </> ); }; export default App; ``` --- ## โš™๏ธ Props | Prop | Type | Default | Description | | ------- | -------- | ------- | --------------------------------------- | | `speed` | `number` | `1` | Controls scroll speed (higher = faster) | --- ## ๐Ÿ’ก Why Choose smooth-motion? * Works with **React 17+ and React 19** * **TypeScript-ready** โ€” zero config required * Minimal footprint, fast performance * Perfect for **landing pages, portfolios, and apps** * Designed for **developers who love smooth UI animations** โœ… One package, dual compatibility, zero friction. --- ## ๐Ÿ› ๏ธ Development & Contribution 1. Clone the repo 2. Install dependencies: `npm install` 3. Build the package: `npm run build` 4. Test locally via `npm link` or `npm pack` 5. Open an issue or PR to contribute ๐Ÿš€ --- ## ๐Ÿ“œ License This project is licensed under the **MIT License** โ€” see the [LICENSE](LICENSE) file. --- ## ๐Ÿ”— Links * ๐ŸŒ Author Website: [https://thinakaran.dev](https://thinakaran.dev) * ๐Ÿ“ฆ npm: [smooth-motion](https://www.npmjs.com/package/smooth-motion) * ๐Ÿ’ป GitHub Repo: [UseSmoothScroll](https://github.com/thinakaranmanokaran/SmoothScroll)