Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-stickyish

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-stickyish

React hook for a sticky header that re-appears on scroll up

  • 0.2.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

react-stickyish

npm version npm bundle size

React Hook that allows for headers to be stickyish, so they disappear when scrolling down but reappear when scrolling up.

Check out the demo!

Install

npm install --save react-stickyish

Usage

The hook takes in one param for the ref of the element that should be made stickyish. The hook returns an object with the { top, position } CSS properties for the navbar that should be stickyish. You can extract these items out, or pass them into your HTML element directly.

import React, { useRef } from "react";
import { useStickyish } from "react-stickyish";

function Navbar() {
  const ref = useRef();
  const stickyish = useStickyish(ref);
  return (
    <nav ref={ref} style={stickyish}>
      ...
    </nav>
  );
}

Keywords

FAQs

Package last updated on 27 Aug 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc