# @artginzburg/use-scroll-sync

> Sync scroll positions between multiple elements (on both axes).

Latest version **1.0.2** (published 2022-03-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install @artginzburg/use-scroll-sync
pnpm add @artginzburg/use-scroll-sync
yarn add @artginzburg/use-scroll-sync
bun add @artginzburg/use-scroll-sync
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2022-03-01 |
| First published | 2022-03-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 18.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Travis Arnold |
| Maintainers | artginzburg |
| Keywords | react, sync, scroll, hook |

## Links

- npm: https://www.npmjs.com/package/@artginzburg/use-scroll-sync
- Repository: https://github.com/artginzburg/use-scroll-sync
- Homepage: https://github.com/artginzburg/use-scroll-sync#readme
- Issues: https://github.com/artginzburg/use-scroll-sync/issues
- npm.io page: https://npm.io/package/@artginzburg/use-scroll-sync

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2022-03-01
- 1.0.1 — 2022-03-01

## README

# useScrollSync

Sync scroll positions between multiple elements.

This fork differs from the main one — it allows to also sync vertical scrolling position, in addition to horizontal, and requires first argument as the synchronization options.

<small>Note, if the main thread is too busy or the user's battery is low, scrollbars can get out of sync.</small>

## Install

```bash
yarn add @artginzburg/use-scroll-sync
```

```bash
npm install @artginzburg/use-scroll-sync
```

## Example

```jsx
import * as React from 'react'
import { useScrollSync } from 'use-scroll-sync'

function SyncedScrollbars() {
  const headerRef = React.useRef()
  const mainRef = React.useRef()
  useScrollSync({ vertical: true }, headerRef, mainRef)
  return (
    <div>
      <header ref={headerRef}>...</header>
      <main ref={mainRef}>...</main>
    </div>
  )
}
```

---
_Source: https://npm.io/package/@artginzburg/use-scroll-sync · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
