{"id":13525207,"url":"https://github.com/developit/preact-virtual-list","last_synced_at":"2025-04-06T16:11:20.145Z","repository":{"id":57095385,"uuid":"56397188","full_name":"developit/preact-virtual-list","owner":"developit","description":":card_index: Virtual List that only renders visible items. Supports millions of rows.","archived":false,"fork":false,"pushed_at":"2019-07-22T23:14:11.000Z","size":12,"stargazers_count":227,"open_issues_count":7,"forks_count":24,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-01T22:10:02.538Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://jsfiddle.net/developit/qqan9pdo/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/developit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-04-16T17:40:06.000Z","updated_at":"2025-02-02T21:37:48.000Z","dependencies_parsed_at":"2022-08-22T23:10:12.578Z","dependency_job_id":null,"html_url":"https://github.com/developit/preact-virtual-list","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developit%2Fpreact-virtual-list","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developit%2Fpreact-virtual-list/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developit%2Fpreact-virtual-list/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developit%2Fpreact-virtual-list/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/developit","download_url":"https://codeload.github.com/developit/preact-virtual-list/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247509221,"owners_count":20950232,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T06:01:16.862Z","updated_at":"2025-04-06T16:11:20.117Z","avatar_url":"https://github.com/developit.png","language":"JavaScript","readme":"# `\u003cVirtualList /\u003e` \u003csub\u003e_for [Preact]_\u003c/sub\u003e\n\n[![NPM](https://img.shields.io/npm/v/preact-virtual-list.svg)](https://www.npmjs.com/package/preact-virtual-list)\n[![Travis](https://travis-ci.org/developit/preact-virtual-list.svg?branch=master)](https://travis-ci.org/developit/preact-virtual-list)\n\nA \"virtual\" list component that renders only visible rows of a given data set.\n\nUseful for those super important business applications where one must show _all_ million rows.\n\n#### [Demo](https://jsfiddle.net/developit/qqan9pdo/)\n\n\u003ca href=\"https://jsfiddle.net/developit/qqan9pdo/\"\u003e\n\u003cimg alt=\"preview\" src=\"https://i.gyazo.com/866e97be9075dd63260dbc5df30075ec.gif\" width=\"420\"\u003e\n\u003c/a\u003e\n\n---\n\n\n## Usage Example\n\nProvide the list of items as `data`, an item renderer as `renderRow`, and the height of a single row as `rowHeight`. Everything else is optional.\n\n```js\n\u003cVirtualList\n    data={['a', 'b', 'c']}\n    renderRow={ row =\u003e \u003cdiv\u003e{row}\u003c/div\u003e }\n    rowHeight={22}\n    overscanCount={10}\n    sync\n/\u003e\n```\n\n\n---\n\n\n## Props\n\n| Prop                | Type       | Description         |\n|---------------------|------------|---------------------|\n| **`data`**          | _Array_    | List of data items\n| **`renderRow`**     | _Function_ | Renders a single row\n| **`rowHeight`**     | _Number_   | Static height of a row\n| **`sync`**          | _Boolean_  | If `true`, forces synchronous rendering \\*\n| **`overscanCount`** | _Number_   | Number of extra rows to render above and below visible list. Defaults to 10. \\*\\*\n\n_**\\* About synchronous rendering:** It's best to try without `sync` enabled first. If the normal async rendering behavior is fine, it's best to leave sync turned off. If you're seeing flickering, enabling sync will ensure every update gets out to the screen without dropping renders, but does so at the expense of actual framerate._\n\n\n_**\\*\\* Why overscan?** Rendering normalized blocks of rows reduces the number of DOM interactions by grouping all row renders into a single atomic update._\n\n| _Without_ Overscan | _With_ Overscan |\n|--------------------|-----------------|\n| \u003cimg src=\"https://i.gyazo.com/e192bf1ca835fbe6ad803f7b6270e424.gif\" height=\"150\"\u003e | \u003cimg src=\"https://i.gyazo.com/478440d1f06fe543e69fff8b88ce7963.gif\" height=\"150\"\u003e |\n\n\n---\n\n## Simple Example\n\n[**View this example on JSFiddle**](https://jsfiddle.net/developit/qqan9pdo/)\n\n```js\nimport VirtualList from 'preact-virtual-list';\n\n// Generate 100,000 rows of data\nconst DATA = [];\nfor (let x=1e5; x--; ) DATA[x] = `Item #${x+1}`;\n\nclass Demo extends Component {\n    // 30px tall rows\n    rowHeight = 30;\n\n    // Renders a single row\n    renderRow(row) {\n        return \u003cdiv class=\"row\"\u003e{row}\u003c/div\u003e;\n    }\n\n    render() {\n        return (\n            \u003cVirtualList sync class=\"list\"\n                data={DATA}\n                rowHeight={this.rowHeight}\n                renderRow={this.renderRow}\n            /\u003e\n        );\n    }\n}\n\nrender(Demo, document.body);\n```\n\n\n---\n\n\n## Functional Example\n\n[**View this example on JSFiddle**](https://jsfiddle.net/developit/qqan9pdo/)\n\n```js\nimport VirtualList from 'preact-virtual-list';\n\n// Generate 100,000 rows of data\nconst DATA = [];\nfor (let x=1e5; x--; ) DATA[x] = `Item #${x+1}`;\n\n// renders a single row\nconst Row = row =\u003e (\n    \u003cdiv class=\"row\"\u003e{row}\u003c/div\u003e\n);\n\nrender((\n    \u003cVirtualList data={DATA} rowHeight={30} renderRow={Row} /\u003e\n), document.body);\n```\n\n\n---\n\n\n### License\n\n[MIT]\n\n\n[Preact]: https://github.com/developit/preact\n[MIT]: http://choosealicense.com/licenses/mit/\n","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevelopit%2Fpreact-virtual-list","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevelopit%2Fpreact-virtual-list","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevelopit%2Fpreact-virtual-list/lists"}