-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: column sizing/resizing guide (#5228)
- Loading branch information
1 parent
ae4c451
commit d45b9a9
Showing
17 changed files
with
911 additions
and
238 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
title: Virtualization | ||
--- | ||
|
||
## Examples | ||
|
||
Want to skip to the implementation? Check out these examples: | ||
|
||
- [virtualized-rows](../examples/react/virtualized-rows) | ||
- [virtualized-infinite-scrolling](../examples/react/virtualized-infinite-scrolling) | ||
|
||
## API | ||
|
||
[TanStack Virtual Virtualizer API](../../../../virtual/v3/docs/api/virtualizer) | ||
|
||
## Guide | ||
|
||
The TanStack Table packages do not come with any virtualization APIs or features built-in, but TanStack Table can easily work with other virtualization libraries like [react-window](https://www.npmjs.com/package/react-window) or TanStack's own [TanStack Virtual](https://tanstack.com/virtual/v3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
node_modules | ||
.DS_Store | ||
dist | ||
dist-ssr | ||
*.local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Example | ||
|
||
To run this example: | ||
|
||
- `npm install` or `yarn` | ||
- `npm run start` or `yarn start` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Vite App</title> | ||
<script type="module" src="https://cdn.skypack.dev/twind/shim"></script> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="/src/main.tsx"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "tanstack-table-example-column-resizing-performant", | ||
"version": "0.0.0", | ||
"private": true, | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "vite build", | ||
"serve": "vite preview --port 3001", | ||
"start": "vite" | ||
}, | ||
"dependencies": { | ||
"@tanstack/react-table": "8.11.2", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0" | ||
}, | ||
"devDependencies": { | ||
"@rollup/plugin-replace": "^5.0.1", | ||
"@vitejs/plugin-react": "^2.2.0", | ||
"vite": "^3.2.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
* { | ||
box-sizing: border-box; | ||
} | ||
|
||
html { | ||
font-family: sans-serif; | ||
font-size: 14px; | ||
} | ||
|
||
table, | ||
.divTable { | ||
border: 1px solid lightgray; | ||
width: fit-content; | ||
} | ||
|
||
.tr { | ||
display: flex; | ||
} | ||
|
||
tr, | ||
.tr { | ||
width: fit-content; | ||
height: 30px; | ||
} | ||
|
||
th, | ||
.th, | ||
td, | ||
.td { | ||
box-shadow: inset 0 0 0 1px lightgray; | ||
padding: 0.25rem; | ||
} | ||
|
||
th, | ||
.th { | ||
padding: 2px 4px; | ||
position: relative; | ||
font-weight: bold; | ||
text-align: center; | ||
height: 30px; | ||
} | ||
|
||
td, | ||
.td { | ||
height: 30px; | ||
} | ||
|
||
.resizer { | ||
position: absolute; | ||
top: 0; | ||
height: 100%; | ||
right: 0; | ||
width: 5px; | ||
background: rgba(0, 0, 0, 0.5); | ||
cursor: col-resize; | ||
user-select: none; | ||
touch-action: none; | ||
} | ||
|
||
.resizer.isResizing { | ||
background: blue; | ||
opacity: 1; | ||
} | ||
|
||
@media (hover: hover) { | ||
.resizer { | ||
opacity: 0; | ||
} | ||
|
||
*:hover > .resizer { | ||
opacity: 1; | ||
} | ||
} |
Oops, something went wrong.