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

react-stickynode

Package Overview
Dependencies
Maintainers
0
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-stickynode

A performant and comprehensive React sticky component

  • 5.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
102K
decreased by-17.27%
Maintainers
0
Weekly downloads
 
Created

What is react-stickynode?

The react-stickynode package is a React component that allows you to create sticky elements that remain fixed at the top of the viewport as you scroll down the page. This is particularly useful for creating sticky headers, sidebars, and other UI elements that need to stay visible while the user scrolls.

What are react-stickynode's main functionalities?

Basic Sticky Element

This code demonstrates how to create a basic sticky header using the react-stickynode package. The header will stick to the top of the viewport as the user scrolls down the page.

```jsx
import React from 'react';
import Sticky from 'react-stickynode';

const StickyHeader = () => (
  <Sticky>
    <header style={{ background: 'lightblue', padding: '10px' }}>
      I am a sticky header
    </header>
  </Sticky>
);

export default StickyHeader;
```

Sticky Element with Offset

This code demonstrates how to create a sticky sidebar with an offset using the react-stickynode package. The sidebar will stick to the top of the viewport with a 50px offset as the user scrolls down the page.

```jsx
import React from 'react';
import Sticky from 'react-stickynode';

const StickySidebar = () => (
  <Sticky top={50}>
    <aside style={{ background: 'lightgreen', padding: '10px' }}>
      I am a sticky sidebar with an offset
    </aside>
  </Sticky>
);

export default StickySidebar;
```

Sticky Element with Bottom Boundary

This code demonstrates how to create a sticky footer with a bottom boundary using the react-stickynode package. The footer will stick to the top of the viewport until the user scrolls past 500px from the top of the page.

```jsx
import React from 'react';
import Sticky from 'react-stickynode';

const StickyFooter = () => (
  <Sticky bottomBoundary={500}>
    <footer style={{ background: 'lightcoral', padding: '10px' }}>
      I am a sticky footer with a bottom boundary
    </footer>
  </Sticky>
);

export default StickyFooter;
```

Other packages similar to react-stickynode

Keywords

FAQs

Package last updated on 16 Dec 2024

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