# wil-react-sticky

> Sticky Component For Header, Sidebar ...

Latest version **1.0.5** (published 2020-06-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install wil-react-sticky
pnpm add wil-react-sticky
yarn add wil-react-sticky
bun add wil-react-sticky
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2020-06-26 |
| First published | 2019-11-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=8 |
| Dependencies | 0 |
| Unpacked size | 116.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 19 |
| Author | wiloke1 |
| Maintainers | longnguyen |

## Links

- npm: https://www.npmjs.com/package/wil-react-sticky
- Repository: https://github.com/wiloke1/wil-react-sticky
- Homepage: https://github.com/wiloke1/wil-react-sticky#readme
- Issues: https://github.com/wiloke1/wil-react-sticky/issues
- npm.io page: https://npm.io/package/wil-react-sticky

## Recent versions

- 1.0.5 (latest) — 2020-06-26
- 1.0.4 — 2020-03-26
- 1.0.3 — 2019-12-23
- 1.0.2 — 2019-11-07
- 1.0.1 — 2019-11-06
- 1.0.0 — 2019-11-06

## README

# wil-react-sticky

Sticky Component For Header, Sidebar, Section list, etc.
Useful when a sidebar is too tall or too short compared to the rest of the content.

[![NPM](https://img.shields.io/npm/v/wil-react-sticky.svg)](https://www.npmjs.com/package/wil-react-sticky)

## Install

**npm**

```bash
npm install wil-react-sticky --save
```

**yarn**

```bash
yarn add wil-react-sticky
```

## Example

#### [1. Sidebar sticky](https://6qzgv.codesandbox.io/)

#### [2. Sidebar sticky box 2](https://6qzgv.codesandbox.io/sticky-box2)

#### [3. Section list](https://6qzgv.codesandbox.io/section-list)

#### [4. Header sticky](https://6qzgv.codesandbox.io/header-sticky)

#### [5. Render Props (demo change background color)](https://6qzgv.codesandbox.io/render-props)

## Usage

```js
import React from "react";
import Sticky from "wil-react-sticky";

class BasicSticky extends React.Component {
  render() {
    return (
      <Sticky>
        <header className="header">Header sticky</header>
      </Sticky>
    )
  }
```

## API

| Prop                  | Type                                | Default | Description |
| :---------            | :-------:                           | :-----: | :----------- |
| containerSelectorFocus   | `string`                     | -       | Move according to the parent component (value same `querySelector` vanilla javascript). Example [Sidebar sticky](https://6qzgv.codesandbox.io/)  |
| offsetTop             | `number`                     | `0`       | Offset from the top of the viewport (in pixels) |
| zIndex    | `number`      | `10`       | The `z-index` of the Sticky |
| stickyEnableRange    | `Array<number>`      | `[0, Infinity]`       | Sticky working in [min-width, max-width]  |
| children    | `ReactNode or (isSticky: boolean) => ReactNode`      | -       | ReactNode or render props (example [render props](https://6qzgv.codesandbox.io/render-props))  |
| onChange    | `(isSticky: boolean) => void`      | -       | onChange when position fixed  |

## License

MIT © [wiloke1](https://github.com/wiloke1)

---
_Source: https://npm.io/package/wil-react-sticky · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
