npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-concise-scrollbar

v1.0.3

Published

a React concise scrollbar component with macOS style

Downloads

2

Readme

react-concise-scrollbar

npm license

a React concise scrollbar component with macOS style

Advantages

  • Concise and simple style (hidden when not in use)
  • Automatically adapt to the resize of wrapper and content area
  • Based on traditional design strategy
    The usage of react-concise-scrollbar fits well with developers' original development pattern.
    When we need a scroll area, we should first creat a wrapper with exact height and set overflow:scroll or auto. Then put the content into the wrapper.When the height of the content exceeds the height of the wrapper, it could be scrolled.
    If you want to use react-concise-scrollbar to change the scrollbar's style in your scroll area, you can just insert the component between the wrapper area and the content area.
  • No need to send height or width to component as props
    Since react-concise-scrollbar is used based on original design pattern, all you need to do is setting the correct height and width of the wrapper area in original mode. react-concise-scrollbar can automatically get these size and render correctly.

Basic Usage

Installation

npm i react-concise-scrollbar

Import

import ConciseScrollBar from "react-concise-scrollbar";

Usage

react-concise-scrollbar is used based on the default scroll area.
Developers should make a default scroll area first and then insert the component between the wrapper and the content.

js part

function Example(){
    return(
        <div className="example-wrapper">
            <ConciseScrollBar>
                <div className="example-content">your content</div>
            </ConciseScrollBar>
        </div>
    )
}

css part (set a scroll area)

.example-wrapper{
  padding: 10px;
  overflow-y: scroll;
  overflow-x: hidden;   
  width: 400px;
  height: 400px;       
  background: lightblue;
}

Use ref to control the scroll position

import {useRef} from "react";
function Example(){
    const scrollRef = useRef();
    return(
        <div>
            <button className="scroll-button" onClick={() => {scrollRef.current.scrollTo(0,0)}}>
                Scroll to Top
            </button>
            <div className="example-wrapper">
                <ConciseScrollBar ref={scrollRef} behavior="smooth">
                    <div className="example-content">
                       your conetnt
                    </div>
                </ConciseScrollBar>
            </div>
        </div>
    )
}

API

| Property | Type | Default | Description | | :--- | :--- | :--- | :--- | | scrollY | boolean | true | If you set scrollY to false, react-concise-scrollbar will not be available. | | behavior | 'auto' or 'smooth' | 'auto' | Change scroll-behavior in react-concise-scrollbar. | | ref | object | - | Send React ref as ref props to the component, you can use customized methods to scroll the window. | | key | string | - | Each components' unique key. |