DEV Community

MD Taseen Khan
MD Taseen Khan

Posted on • Originally published at reactjsexample.com on

A UI library for React projects that allows users to choose a value through scrolling

React-Hook-Scroll ·

A UI library for React projects that allows users to choose a value through scrolling

React-Hook-Scroll is a UI library for React projects that allows users to choose a value through scrolling. It is designed to be compatible with both desktop and mobile environments.

Install

npm i react-hook-scroll
Enter fullscreen mode Exit fullscreen mode

Example

import { useState } from "react";
import { VirtualScroll } from "react-hook-scroll";

function App() {
  const [selected, setSelected] = useState(null);

  return (
    <div className="App">
      <VirtualScroll list={[1, 2, 3, 4, 5]} onItemSelected={setSelected} />
    </div>
  );
}
Enter fullscreen mode Exit fullscreen mode

A UI library for React projects that allows users to choose a value through scrolling

The VirtualScroll component requires two required profiles.

  • list: need a list to let the user choose.
  • onItemSelected: The action to be taken with the item selected by the user is required.

Contributing

Development happens in the open on GitHub and we are grateful for contributions including bug fixes, improvements, and ideas.

License

React-Hook-Scroll is MIT licensed.

GitHub

View Github

Top comments (0)