1.0.7 • Published 1 year ago

semantic-ui-react-scrollbar v1.0.7

Weekly downloads
3
License
MIT
Repository
github
Last release
1 year ago

:closed_book: Check out my new book Clean Code Principles And Patterns: A Software Practitioner's Handbook

semantic-ui-react-scrollbar

Horizontal and vertical scroll bar for Semantic UI React

version build Downloads coverage Quality Gate Status Bugs Vulnerabilities MIT License

Prerequisites

"react": "^16.0.0",
"react-dom": "^16.0.0",
"semantic-ui-react": "^0.87.0"

Installation

npm install --save semantic-ui-react-scrollbar

Demo

Scrollbar demo

Example usage

import React from 'react';
import Scrollbar from 'semantic-ui-react-scrollbar';

class ScrollbarExample extends React.Component {

    constructor(props) {
        super(props);
        this.state = {
            scrollPosition: '0'
        };
    }

    changeScrollPosition = (newScrollPosition) => {
        this.setState({ scrollPosition: newScrollPosition });
    }

    render() => {(
        <Scrollbar maxScrollPosition={10} changeScrollPosition={this.changeScrollPosition} />
    )};
}

See full example in demo directory

Mandatory Scrollbar properties

changeScrollPosition: (newScrollPosition: number) => void,
maxScrollPosition: number

     

Optional Scrollbar properties

propertydescription
classNameclass name(s) for HTML outer div element
orientationScroll bar orientation

Optional Scrollbar property types

className: string,
orientation: 'horizontal' | 'vertical'
    

Default values for optional properties

className: undefined,
orientation: 'horizontal'

Keyboard actions

KeyAction
ArrowUpScrolls vertical scroll bar upwards
ArrowDownScrolls vertical scroll bar downwards
ArrowLeftScrolls horizontal scroll bar to the left
ArrowRightScrolls horizontal scroll bar to the right

Styling example

<Scrollbar className="myScrollbar" .... />

Style scroll bar in CSS:

.myScrollbar .button {
    /* style buttons here */
}

.myScrollbar .track {
   /* style scroll bar track here */
}

.myScrollbar .thumb {
    /* style scroll bar thumb here */
}

License

MIT License

1.0.2

1 year ago

1.0.1

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.0

5 years ago