@benestudioco/react-scrollfade

1.0.2 • Public • Published

React Scrollfade

React Scrollfade is a React component designed to dynamically fade out the bottom of a scrollable element based on the scrollbars position.

demo

Installation

You can install the library using npm:

npm install @benestudioco/react-scrollfade

How to use it

It works with zero configuration needed. Just include it as a direct child of the scrollable element. The fade makes the bottom of the element transparent, so the color of the fade is determined by what is under it.

import React from "react";
import ScrollFade from "@benestudioco/react-scrollfade";

export const Example = () =>
 <div
        style={{
            width: 200,
            height: 100,
            overflowY: 'auto',
            background: 'red',
        }}
    >
        <ScrollFade />
        Dolor amet eu occaecat excepteur do adipisicing cillum duis. Est ullamco ullamco sit ea irure consequat
        id do ex enim consectetur nisi duis elit. Qui mollit magna exercitation est sit.
    </div>

Browser Support

The component utilizes CSS masks and -webkit-masks as a fallbak. See browser compatibilities here: https://caniuse.com/?search=mask

Examples

There are interactive examples.

npm run examples starts an instance where you can look at them.

Contribution

We welcome contributions in the form of pull requests. The examples also serve as a development server.

If you have any issues, questions or suggestions please open a new Issue.

Package Sidebar

Install

npm i @benestudioco/react-scrollfade

Weekly Downloads

188

Version

1.0.2

License

MIT

Unpacked Size

8.31 kB

Total Files

8

Last publish

Collaborators

  • admin.benestudio
  • gabor_paholics_benestudio