0.2.0 • Published 2 years ago

react-viewport-trap v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

ViewportTrap Component

ViewportTrap is a headless React component that helps ensure that its children are always visible within the viewport. This is particularly useful for UI elements like tooltips or dropdowns that might be hidden or cut-off due to their position near the edge of the viewport.

Storybook DEMO

Installation

To use ViewportTrap, simply import it in your React project:

npm i react-viewport-trap
import { ViewportTrap } from 'react-viewport-trap'

Usage

Wrap the component that you want to keep in the viewport at all times with ViewportTrap.

<ViewportTrap>
  <MyTooltip />
</ViewportTrap>
0.2.0

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago