Installations
npm install react-scroll-into-view
Developer Guide
Typescript
Yes
Module System
ESM
Node Version
20.9.0
NPM Version
10.7.0
Score
56.8
Supply Chain
76.3
Quality
79.3
Maintenance
100
Vulnerability
100
License
Releases
Patch security vulnerability in 3rd party libraries
Published on 17 Jun 2024
Adjustments to to exported files
Published on 29 Dec 2023
TypeScript rewrite
Published on 01 Aug 2023
Fix: peer dependency blocked React v17
Published on 21 Feb 2022
Generating both ESM and CJS modules
Published on 09 Jan 2022
Dependencies upgrade & ESM module by default
Published on 28 Sept 2021
Contributors
Unable to fetch Contributors
Languages
TypeScript (97.56%)
Shell (2.44%)
Developer
dominikbulaj
Download Statistics
Total Downloads
1,121,067
Last Day
106
Last Week
3,913
Last Month
15,889
Last Year
219,559
GitHub Statistics
52 Stars
178 Commits
6 Forks
3 Watching
2 Branches
1 Contributors
Bundle Size
979.00 B
Minified
575.00 B
Minified + Gzipped
Package Meta Information
Latest Version
2.1.3
Package Id
react-scroll-into-view@2.1.3
Unpacked Size
12.99 kB
Size
3.88 kB
File Count
9
NPM Version
10.7.0
Node Version
20.9.0
Publised On
17 Jun 2024
Total Downloads
Cumulative downloads
Total Downloads
1,121,067
Last day
1%
106
Compared to previous day
Last week
-3.2%
3,913
Compared to previous week
Last month
-27.8%
15,889
Compared to previous month
Last year
39.6%
219,559
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dev Dependencies
31
React scroll-into-view
Fast & declarative way for scrolling to any element on page. Weights less than 600B (minified + gzipped)!
Idea behind
While developing landing page we needed way to scroll page to focus on registration form. It was obvious we will use element.scrollIntoView we just need find nice way how to. This is just simple React element that provides declarative way to scroll to any element on page when it's clicked.
Demo
Check out that codesandbox example
Installation
yarn add react-scroll-into-view
or if you use npm:
npm i --save react-scroll-into-view
How to use
First import it
import ScrollIntoView from 'react-scroll-into-view'
Then use it
<ScrollIntoView selector="#footer">
<button className="mdl-button mdl-js-button mdl-button--raised">
Jump to bottom
</button>
</ScrollIntoView>
<!-- somewhere down on our page we have our target element -->
<div id="footer">Scroll target element</div>
Props
Name | Type | Default | Description |
---|---|---|---|
children | React.ReactNode | The content of the component | |
selector | string | Required. Valid CSS Selector to element to which we want to scroll | |
smooth | boolean | true | Scroll behavior; when true - transition animation will be smooth. Same as setting scrollOptions.behavior = smooth |
style | React.CSSProperties | CSS styles passed to element NOTE prior v1.4.0 default value was {display: 'inline'} | |
alignToTop | boolean | false | Whether top of the element should be aligned to the top of the visible area. Default: aligns to bottom of element |
className | string | Optional class name to be applied to element | |
onClick | Function with signature:(event: React.MouseEvent<HTMLElement>) => void | Callback fired on click | |
scrollOptions | ScrollIntoViewOptions | {} | Scroll options. See scrollIntoViewOptions on MDN docs. Only valid properties will be used.Accepts options: behavior (values: auto or smooth )block (start , center , end , or nearest )inline (start , center , end , or nearest ) |
Changelog
Please check releases tab for full details
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Info: jobLevel 'contents' permission set to 'read': .github/workflows/build.yml:14
- Warn: no topLevel permission defined: .github/workflows/build.yml:1
- Info: no jobLevel write permissions found
Reason
4 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
Reason
4 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 3
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/dominikbulaj/react-scroll-into-view/build.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/dominikbulaj/react-scroll-into-view/build.yml/master?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/build.yml:23
- Info: 0 out of 2 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 npmCommand dependencies pinned
Reason
Found 0/15 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 16 are checked with a SAST tool
Score
4.6
/10
Last Scanned on 2024-12-16
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to react-scroll-into-view
react-scroll-into-view-if-needed
A thin component wrapper around scroll-into-view-if-needed
react-native-scroll-into-view
React-Native port of DOMElement.scrollIntoView() web function, for ScrollView
@types/react-scroll-into-view-if-needed
TypeScript definitions for react-scroll-into-view-if-needed
react-scroll-into-view-mixin
A ReactJS mixin that enables components to scroll HTML elements into view.