@brianmcallister/react-auto-scroll
Automatically scroll an element to the bottom
react-auto-scroll
is a React component that automatically scrolls a containing element to the bottom.
Table of contents
Demo
Hosted demo: https://react-auto-scroll.netlify.com/
You can also run the demo locally. To get started:
git clone git@github.com:brianmcallister/react-auto-scroll.git
cd react-auto-scroll/demo
npm i
npm link @brianmcallister/react-auto-scroll
npm link ../node_modules/react
npm start
Installation
npm install @brianmcallister/react-auto-scroll
Usage
import AutoScroll from '@brianmcallister/react-auto-scroll';
const MyComponent = ({ someContent }) => (
<AutoScroll>
{someContent}
</AutoScroll>
);
API
AutoScroll
This is the default export. Use this React component to scroll a container to the bottom when the children change.
interface Props {
checkBoxId?: string;
children: React.ReactNode;
className?: string;
height?: number;
optionText?: string;
preventInteraction?: boolean;
scrollBehavior?: 'smooth' | 'auto';
showOption?: boolean;
}