react-scrollable-component
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

react-scrollable-component

Component for custom scrollbar

NPM JavaScript Style Guide

Install

npm install --save react-scrollable-component

Usage

import React, { Component } from 'react'
 
import ReactScrollableComponent from 'react-scrollable-component'
 
class Example extends Component {
  render() {
    return (
        <ReactScrollableComponent scrollThumbStyle={{width: "4px", backgroundColor: "rgba(0, 0, 0, 0.5)", borderRadius: "2px"}} maxHeight={90}>
             <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab ad at dignissimos eveniet exercitationem facilis
                iste laboriosam libero molestiae nostrum obcaecati officiis porro possimus quos saepe sunt tempora, totam
                veniam?
             </p>
        </ReactScrollableComponent>
    )
  }
}

Props

scrollThumbStyle?: React.CSSProperties  // Style of the scrollthumb. You can not change the  height, top, right and position properties.
maxHeight?: number                      // The maximum height of the scrollable container
className?: string                      // Name of the scrollable container class
hiddenIfNotUsed?: boolean               // Property to hide the scrollbar when there is no mouse wheel action (default false)

Note

This component will use the default scrollbar on mobile devices and tablets

License

MIT © make1986

Dependencies (0)

    Dev Dependencies (29)

    Package Sidebar

    Install

    npm i react-scrollable-component

    Weekly Downloads

    1

    Version

    1.0.4

    License

    MIT

    Unpacked Size

    46.1 kB

    Total Files

    10

    Last publish

    Collaborators

    • tmtsoft