nextjs-headroom
v1.0.5
Published
Modern headroom library which supports Next.js with SSR
Downloads
47
Maintainers
Readme
Nextjs headroom
This is modern version of the react-headroom package, adopted to the nextjs framework.
Install
npm install nextjs-headroom
Usage
import { Headroom } from "nextjs-headroom";
<Headroom>
<h1>You can put anything you'd like inside the Headroom Component</h1>
</Headroom>
Props
pin
- (optional,boolean
) pin headroom permanentlyupTolerance
- (optional,number
) scroll tolerance in px when scrolling up before component is pinneddownTolerance
- (optional,number
) scroll tolerance in px when scrolling down before component is pinnedpinStart
- (optional,number
) Height in px where the header should start and stop pinning. Useful when you have another element above Headroom componentstyle
- (optional,React.CSSProperties
) custom stylesonPin
- (optional,function
) callback called when header is pinnedonUnpin
- (optional,function
) callback called when header is unpinnedonUnfix
- (optional,function
) callback called when header position is no longer fixed