use-overflow
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

use-overflow

A React Hook that allows you to detect X and Y overflow.

NPM JavaScript Style Guide

Install

npm install --save use-overflow
OR
yarn add use-overflow

Usage

Check out the live example.

import * as React from 'react'

import { useOverflow } from 'use-overflow'

const Example = () => {
  const horizontalRef = React.useRef(null);
  const { refXOverflowing, refXScrollBegin, refXScrollEnd } = useOverflow(horizontalRef);

  const verticalRef = React.useRef(null);
  const { refYOverflowing, refYScrollBegin, refYScrollEnd } = useOverflow(verticalRef);

  return (
    <div>
      {/* Conditional do stuff based on overflow! */}
    </div>
  )
}

License

MIT © amorriscode


This hook is created using create-react-hook.

Dependencies (0)

    Dev Dependencies (15)

    Package Sidebar

    Install

    npm i use-overflow

    Weekly Downloads

    1,755

    Version

    1.2.0

    License

    MIT

    Unpacked Size

    25.8 kB

    Total Files

    9

    Last publish

    Collaborators

    • amorrisc0de