Installations
npm install react-table-sticky
Score
99.1
Supply Chain
100
Quality
75.6
Maintenance
100
Vulnerability
100
License
Developer
guillaumejasmin
Developer Guide
Module System
CommonJS
Min. Node Version
Typescript Support
No
Node Version
10.16.0
NPM Version
6.9.0
Statistics
189 Stars
33 Commits
21 Forks
8 Watching
25 Branches
2 Contributors
Updated on 22 Mar 2024
Bundle Size
2.21 kB
Minified
1.03 kB
Minified + Gzipped
Languages
TypeScript (86.21%)
JavaScript (12.33%)
HTML (1.46%)
Total Downloads
Cumulative downloads
Total Downloads
10,880,044
Last day
-30.9%
8,415
Compared to previous day
Last week
-11.6%
55,197
Compared to previous week
Last month
-17.2%
298,326
Compared to previous month
Last year
-15.2%
3,491,975
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dev Dependencies
31
Documentation
- Demo on CodeSandbox
- Features
- Simple example
- Sticky columns for react-table v6
- Browser support
- Contribute
Features
- sticky header
- sticky footer
- sticky columns left and/or right
- full customizable
Simple example
Steps:
- create CSS classes
.table
.header
.body
.sticky
etc... (check following example) - create HTML elements
<div className="table sticky">
,<div className="header">
,<div className="body">
etc... - add
useSticky
hook - then, add
sticky: 'left'
orsticky: 'right'
to your column
full example:
1import React from 'react'; 2import styled from 'styled-components'; 3import { useTable, useBlockLayout } from 'react-table'; 4import { useSticky } from 'react-table-sticky'; 5 6const Styles = styled.div` 7 .table { 8 border: 1px solid #ddd; 9 10 .tr { 11 :last-child { 12 .td { 13 border-bottom: 0; 14 } 15 } 16 } 17 18 .th, 19 .td { 20 padding: 5px; 21 border-bottom: 1px solid #ddd; 22 border-right: 1px solid #ddd; 23 background-color: #fff; 24 overflow: hidden; 25 26 :last-child { 27 border-right: 0; 28 } 29 } 30 31 &.sticky { 32 overflow: scroll; 33 .header, 34 .footer { 35 position: sticky; 36 z-index: 1; 37 width: fit-content; 38 } 39 40 .header { 41 top: 0; 42 box-shadow: 0px 3px 3px #ccc; 43 } 44 45 .footer { 46 bottom: 0; 47 box-shadow: 0px -3px 3px #ccc; 48 } 49 50 .body { 51 position: relative; 52 z-index: 0; 53 } 54 55 [data-sticky-td] { 56 position: sticky; 57 } 58 59 [data-sticky-last-left-td] { 60 box-shadow: 2px 0px 3px #ccc; 61 } 62 63 [data-sticky-first-right-td] { 64 box-shadow: -2px 0px 3px #ccc; 65 } 66 } 67 } 68`; 69 70function TableDemo() { 71 const columns = [ 72 { 73 Header: 'First Name', 74 accessor: 'firstName', 75 sticky: 'left', 76 }, 77 { 78 Header: 'Last Name', 79 accessor: 'lastName', 80 sticky: 'left', 81 }, 82 ... 83 { 84 Header: 'age', 85 accessor: 'age', 86 sticky: 'right', 87 } 88 ] 89 90 const data = [ ... ] 91 92 const { 93 getTableProps, 94 getTableBodyProps, 95 headerGroups, 96 rows, 97 prepareRow, 98 } = useTable( 99 { 100 columns, 101 data, 102 }, 103 useBlockLayout, 104 useSticky, 105 ); 106 107 // Workaround as react-table footerGroups doesn't provide the same internal data than headerGroups 108 const footerGroups = headerGroups.slice().reverse(); 109 110 return ( 111 <Styles> 112 <div {...getTableProps()} className="table sticky" style={{ width: 1000, height: 500 }}> 113 <div className="header"> 114 {headerGroups.map((headerGroup) => ( 115 <div {...headerGroup.getHeaderGroupProps()} className="tr"> 116 {headerGroup.headers.map((column) => ( 117 <div {...column.getHeaderProps()} className="th"> 118 {column.render('Header')} 119 </div> 120 ))} 121 </div> 122 ))} 123 </div> 124 <div {...getTableBodyProps()} className="body"> 125 {rows.map((row) => { 126 prepareRow(row); 127 return ( 128 <div {...row.getRowProps()} className="tr"> 129 {row.cells.map((cell) => ( 130 <div {...cell.getCellProps()} className="td"> 131 {cell.render('Cell')} 132 </div> 133 ))} 134 </div> 135 ); 136 })} 137 </div> 138 <div className="footer"> 139 {footerGroups.map((footerGroup) => ( 140 <div {...footerGroup.getHeaderGroupProps()} className="tr"> 141 {footerGroup.headers.map((column) => ( 142 <div {...column.getHeaderProps()} className="td"> 143 {column.render('Footer')} 144 </div> 145 ))} 146 </div> 147 ))} 148 </div> 149 </div> 150 </Styles> 151 ); 152} 153
Tips: if your table contain at least one header group, place yours sticky columns into a group too (even with an empty Header name)
1const columns = [ 2 { 3 Header: ' ', 4 sticky: 'left', 5 columns: [ 6 { 7 Header: 'First Name', 8 accessor: 'firstName', 9 }, 10 { 11 Header: 'Last Name', 12 accessor: 'lastName', 13 }, 14 ] 15 }, 16 { 17 Header: 'Other group', 18 columns: [ 19 ... 20 ] 21 } 22]
Sticky columns for React Table v6
If you search tool for sticky position in React Table v6, take a look at react-table-hoc-fixed-columns
Browser support
Check CSS sticky support https://caniuse.com/#search=sticky
Contribute
git clone https://github.com/guillaumejasmin/react-table-sticky.git
npm install
npm run demo
- Go to http://localhost:8080
No vulnerabilities found.
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
Found 1/26 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- 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
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 5 are checked with a SAST tool
Reason
102 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw
- Warn: Project is vulnerable to: GHSA-whgm-jr23-g3j9
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25
- Warn: Project is vulnerable to: GHSA-4w2v-q235-vp99
- Warn: Project is vulnerable to: GHSA-cph5-m8f7-6c5x
- Warn: Project is vulnerable to: GHSA-wf5p-g6vw-rhxx
- Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw
- Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c
- Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq
- Warn: Project is vulnerable to: GHSA-3wcq-x3mq-6r9p
- Warn: Project is vulnerable to: GHSA-vh7m-p724-62c2
- Warn: Project is vulnerable to: GHSA-r9p9-mrjm-926w
- Warn: Project is vulnerable to: GHSA-434g-2637-qmqr
- Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m
- Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw
- Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p
- Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747
- Warn: Project is vulnerable to: GHSA-6h5x-7c5m-7cr7
- Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc
- Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx
- Warn: Project is vulnerable to: GHSA-74fj-2j2h-c42q
- Warn: Project is vulnerable to: GHSA-pw2r-vq6v-hr8c
- Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc
- Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp
- Warn: Project is vulnerable to: GHSA-8r6j-v8pm-fqw3
- Warn: Project is vulnerable to: MAL-2023-462
- Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6
- Warn: Project is vulnerable to: GHSA-62gr-4qp9-h98f
- Warn: Project is vulnerable to: GHSA-f52g-6jhx-586p
- Warn: Project is vulnerable to: GHSA-2cf5-4w76-r9qv
- Warn: Project is vulnerable to: GHSA-3cqr-58rm-57f8
- Warn: Project is vulnerable to: GHSA-g9r4-xpmj-mj65
- Warn: Project is vulnerable to: GHSA-q2c6-c6pm-g3gh
- Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44
- Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988
- Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj
- Warn: Project is vulnerable to: GHSA-pfq8-rq6v-vf5m
- Warn: Project is vulnerable to: GHSA-6x33-pw7p-hmpq
- Warn: Project is vulnerable to: GHSA-c7qv-q95q-8v27
- Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37
- Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22
- Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp
- Warn: Project is vulnerable to: GHSA-896r-f27r-55mw
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-6c8f-qphg-qjgp
- Warn: Project is vulnerable to: GHSA-76p3-8jx3-jpfq
- Warn: Project is vulnerable to: GHSA-3rfm-jhwj-7488
- Warn: Project is vulnerable to: GHSA-hhq3-ff78-jv3g
- Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw
- Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m / GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-92xj-mqp7-vmcj
- Warn: Project is vulnerable to: GHSA-wxgw-qj99-44c2
- Warn: Project is vulnerable to: GHSA-5rrq-pxf6-6jx5
- Warn: Project is vulnerable to: GHSA-8fr3-hfg3-gpgp
- Warn: Project is vulnerable to: GHSA-gf8q-jrpm-jvxq
- Warn: Project is vulnerable to: GHSA-2r2c-g63r-vccr
- Warn: Project is vulnerable to: GHSA-cfm4-qjh2-4765
- Warn: Project is vulnerable to: GHSA-x4jg-mjrx-434g
- Warn: Project is vulnerable to: GHSA-5fw9-fq32-wv5p
- Warn: Project is vulnerable to: GHSA-rp65-9cf3-cjxr
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j
- Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg
- Warn: Project is vulnerable to: GHSA-hxcc-f52p-wc94
- Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p
- Warn: Project is vulnerable to: GHSA-g4rg-993r-mgx7
- Warn: Project is vulnerable to: GHSA-c9g6-9335-x697
- Warn: Project is vulnerable to: GHSA-vx3p-948g-6vhq
- Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9
- Warn: Project is vulnerable to: GHSA-r628-mhmh-qjhw
- Warn: Project is vulnerable to: GHSA-9r2w-394v-53qc
- Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh
- Warn: Project is vulnerable to: GHSA-qq89-hq3f-393p
- Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36
- Warn: Project is vulnerable to: GHSA-4wf5-vphf-c2xc
- Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-9m6j-fcg5-2442
- Warn: Project is vulnerable to: GHSA-hh27-ffr2-f2jc
- Warn: Project is vulnerable to: GHSA-rqff-837h-mm52
- Warn: Project is vulnerable to: GHSA-8v38-pw62-9cw2
- Warn: Project is vulnerable to: GHSA-hgjh-723h-mx2j
- Warn: Project is vulnerable to: GHSA-jf5r-8hm2-f872
- Warn: Project is vulnerable to: GHSA-wr3j-pwj9-hqq6
- Warn: Project is vulnerable to: GHSA-g78m-2chm-r7qv
- Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
- Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh
- Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp
Score
1.7
/10
Last Scanned on 2024-11-25
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 More