yarn add react-smoothy-scroll
npm i react-smoothy-scroll
import SmoothScroll from "react-smoothy-scroll";
<SmoothScroll toId="navbar" duration={1500} allowScroll={true}>
<p>Scroll To Navbar</p>
</SmoothScroll>;
Prop | Default | Type | Description |
---|---|---|---|
toId | undefined | string |
target id for smooth scrolling |
toRef | null | RefObject |
target ref object for smooth scrolling |
duration | 1000 | number |
duration of the smooth scroll |
children | undefined | ReactNode |
react children |
allowScroll | true | bool |
if false scrolling will be disabled |
Inspired by Filip Kubík