All Projects → lucafalasco → preact-custom-scrollbars

lucafalasco / preact-custom-scrollbars

Licence: MIT License
⇅ Preact scrollbars component

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to preact-custom-scrollbars

preact-views
📺 Named views for Preact, with easy-as-pie linking between them.
Stars: ✭ 39 (+95%)
Mutual labels:  preact, preact-components
preact-component-console
A console emulator for preact.
Stars: ✭ 29 (+45%)
Mutual labels:  preact, preact-components
React Custom Scrollbars
React scrollbars component
Stars: ✭ 2,924 (+14520%)
Mutual labels:  scrolling, scrollbars
preact-bind-group
Preact Component to Group Form fields onChange Events to a single Callback
Stars: ✭ 25 (+25%)
Mutual labels:  preact, preact-components
preact-mdc
material design components for preact using material-components-web sass styles (for live demo click the link below)
Stars: ✭ 23 (+15%)
Mutual labels:  preact, preact-components
preact-route-async
Easy asynchronous loading for your router components. For 440B.
Stars: ✭ 36 (+80%)
Mutual labels:  preact, preact-components
preact-perf-profiler
A HOC to enable measuring rendering performance for Preact components
Stars: ✭ 18 (-10%)
Mutual labels:  preact, preact-components
preact-token-input
🔖 A text field that tokenizes input, for things like tags.
Stars: ✭ 57 (+185%)
Mutual labels:  preact, preact-components
preact-motion
A fork of React-Motion to be used with Preact
Stars: ✭ 28 (+40%)
Mutual labels:  preact, preact-components
PenTerm
Terminal config for pentesters.
Stars: ✭ 20 (+0%)
Mutual labels:  scrolling
preact-server-renderer
Server side rendering of preact components
Stars: ✭ 66 (+230%)
Mutual labels:  preact
Scrolling-techniques-using-Android-Design-Support-Library
Como aplicar as técnicas de rolagem do Material Design usando a biblioteca de suporte Android Design Support Library
Stars: ✭ 21 (+5%)
Mutual labels:  scrolling
stoxy
Stoxy is a state management API for all modern Web Technologies
Stars: ✭ 73 (+265%)
Mutual labels:  preact
theodorusclarence.com
💠 Personal website and blog made using Next.js, TypeScript, Tailwind CSS, MDX Bundler, FaunaDB, and Preact.
Stars: ✭ 205 (+925%)
Mutual labels:  preact
preact-urql
Preact bindings for urql
Stars: ✭ 28 (+40%)
Mutual labels:  preact
scala-js-preact
Scala.js facade for the Preact JavaScript library
Stars: ✭ 25 (+25%)
Mutual labels:  preact
fly-kit-preact
A starter kit for building offline / SPA / PWA apps with Preact
Stars: ✭ 28 (+40%)
Mutual labels:  preact
weather-sucks
Weather App with Estonian Mood
Stars: ✭ 23 (+15%)
Mutual labels:  preact
inview
Detect when element scrolled to view
Stars: ✭ 35 (+75%)
Mutual labels:  scrolling
apps
daily.dev application suite
Stars: ✭ 253 (+1165%)
Mutual labels:  preact

preact-custom-scrollbars

This is a port of malte-wessel's react-custom-scrollbars for Preact

npm npm version npm downloads

  • frictionless native browser scrolling
  • native scrollbars for mobile devices
  • fully customizable
  • auto hide
  • auto height
  • universal (runs on client & server)
  • requestAnimationFrame for 60fps
  • no extra stylesheets
  • well tested, 100% code coverage

Documentation

Installation

npm install preact-custom-scrollbars --save

or

yarn add preact-custom-scrollbars

This assumes that you’re using npm or yarn package manager with a module bundler like Webpack or Browserify to consume CommonJS modules.

If you don’t yet use npm or a modern module bundler, and would rather prefer a single-file UMD build that makes PreactCustomScrollbars available as a global object, you can grab a pre-built version from unpkg. We don’t recommend this approach for any serious application, as most of the libraries complementary to preact-custom-scrollbars are only available on npm.

Usage

This is the minimal configuration. Check out the Documentation for advanced usage.

import { Scrollbars } from 'preact-custom-scrollbars';

class App extends Component {
  render() {
    return (
      <Scrollbars style={{ width: 500, height: 300 }}>
        <p>Some great content...</p>
      </Scrollbars>
    );
  }
}

The <Scrollbars> component is completely customizable. Check out the following code:

import { Scrollbars } from 'preact-custom-scrollbars';

class CustomScrollbars extends Component {
  render() {
    return (
      <Scrollbars
        onScroll={this.handleScroll}
        onScrollFrame={this.handleScrollFrame}
        onScrollStart={this.handleScrollStart}
        onScrollStop={this.handleScrollStop}
        onUpdate={this.handleUpdate}
        renderView={this.renderView}
        renderTrackHorizontal={this.renderTrackHorizontal}
        renderTrackVertical={this.renderTrackVertical}
        renderThumbHorizontal={this.renderThumbHorizontal}
        renderThumbVertical={this.renderThumbVertical}
        autoHide
        autoHideTimeout={1000}
        autoHideDuration={200}
        autoHeight
        autoHeightMin={0}
        autoHeightMax={200}
        thumbMinSize={30}
        universal={true}
        {...this.props}>
    );
  }
}

All properties are documented in the API docs

Tests

# Make sure that you've installed the dependencies
npm install
# Run tests
npm test

Code Coverage

# Run code coverage. Results can be found in `./coverage`
npm run test:cov

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].