Skip to content

styled-scrollbar helps you make customized(color, width, ...) scrollbars in react projects!

License

Notifications You must be signed in to change notification settings

amirhrb/styled-scrollbar

Repository files navigation

styled-scrollbar

styled-scrollbar helps you make customized(color, width, ...) scrollbars in react projects!

Quick start

First, run this command in your react app:

npm install styled-scrollbar

for your app.

Then:

import { ScrollbarX } from "styled-scrollbar";

Horizontal scrollbar:

//parent element
<ScrollbarX h={3} w={95}>
  //element that is scrollable👇🏽
  <div>
    //...items in scrolled element
  </div>
</ScrollbarX>

Horizontal scrollbar

Vertical scrollbar:

<ScrollbarY w={4} h={300}>
  //element that is scrollable👇🏽
  <div>
    //...items in scrolled element
  </div>
</ScrollbarY>

Vertical scrollbar


components:

Scrollbar component
Horizontal ScrollbarX
Vertical ScrollbarY

Component Props guide:


color Props:

Prop default data type meaning
trackColor #cecece#cecece string color of scrollbar background
thumbColor #555#555 string color of scrollbar thumb

size Props:

Prop data type meaning
w number width of scrollbar
h number height of scrollbar
r number borderRadius of scrollbar
type default width default height default bRadius
ScrollbarX prevEl width 6px 2px
ScrollbarY 6px prevEl height 2px

New update 3.0.2 :

now in version 3.0.2 you can give style for wraper, track and thumb by passing their own styles that you like not only the colors and sizes!

Prop default data type meaning
thumbStyle {} object styles applid on thumb of scrollbar
trackStyle {} object styles applid on track of scrollbar
wraperStyle {} object styles applid on wraper of scrollbar and scolling element

example:

  <ScrollbarY
      wraperStyle={{ display: 'flex', flexDirection: 'row-reverse' }}
      trackStyle={{ margin: '0 5px' }}
      >
      ...
  </ScrollbarY>

About

styled-scrollbar helps you make customized(color, width, ...) scrollbars in react projects!

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages