# react-vlist

> A virtual list component with customizable item renderers

Latest version **0.2.2** (published 2023-06-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-vlist
pnpm add react-vlist
yarn add react-vlist
bun add react-vlist
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.2 |
| Published | 2023-06-20 |
| First published | 2018-09-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 198.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Guillermo  Quiros |
| Maintainers | gquiman |
| Keywords | react, list, itemRender, virtual, virtualize |

## Links

- npm: https://www.npmjs.com/package/react-vlist
- Homepage: https://github.com/guiqui/react-virtual-list
- npm.io page: https://npm.io/package/react-vlist

## 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

- 0.2.2 (latest) — 2023-06-20
- 0.2.1 — 2018-11-07
- 0.2.0 — 2018-10-25
- 0.1.9 — 2018-10-25
- 0.1.8 — 2018-09-06
- 0.1.7 — 2018-09-06
- 0.1.6 — 2018-09-06
- 0.1.5 — 2018-09-06
- 0.1.4 — 2018-09-05
- 0.1.3 — 2018-09-05
- 0.1.2 — 2018-09-05
- 0.1.1 — 2018-09-05
- 0.1.0 — 2018-09-05

## README

# react-virtual-list
[![npm](https://img.shields.io/npm/v/react-vlist.svg?style=flat-square)](http://npm.im/react-vlist)
[![MIT License](https://img.shields.io/npm/l/react-list.svg?style=flat-square)](http://opensource.org/licenses/MIT)
[![Travis](https://travis-ci.org/guiqui/react-virtual-list.svg?branch=master&style=flat-square)](https://travis-ci.org/guiqui/react-virtual-list)
[![codecov](https://codecov.io/gh/guiqui/react-virtual-list/branch/master/graph/badge.svg)](https://codecov.io/gh/guiqui/react-virtual-list)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/0fa1fa94403a4390912aceed77a919b9)](https://www.codacy.com/app/gquiman/react-virtual-list?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=guiqui/react-virtual-list&amp;utm_campaign=Badge_Grade)

This is a list component that support viartualize rendering.
It can be easly customize by providing its own item renderer.

[![Buy Me A Coffee](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/gquiman)


- Super fast. 😛
- Responsive Components!
- Easy to use.
- Easy to Customize with Item Renderers.
- Support thousand of records.
## Demo
Check out a working demo [here](https://guiqui.github.io/react-virtual-list/index.html)
## Some Demo Code
- [![Edit 5xnwjvjxwx](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/5xnwjvjxwx) Simple Demo.
- [![Edit pj5jpm577](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/pj5jpm577) Demo with select Item,highlight selected and on click handler.
## Installation
```javascript
npm install react-vlist
```
## Configuration

This is an example with a minimal use of the VirtualList component
```javascript
import React from "react";
import ReactDOM from "react-dom";
import VirtualList from "react-vlist";
import "./Application.css";

const data = [{ name: "hola" }];
for (let i = 0; i < 1000; i++) {
  data.push({ name: `Row ${i}` });
}
function App() {
  return (
    <div className="app-container">
      <h1>Virtual List</h1>
      <VirtualList
        className="list"
        data={data}
        itemheight={50}
        renderItems={(item, index, style) => (
          <div className="itemRenderer" key={index} style={style}>
            <img
              className="itemImage"
              src="https://i.stack.imgur.com/4QkvN.jpg?s=64&g=1"
            />
            <div className="itemTitleContainer">
              <div className="itemTitle">{item.name}</div>
              <div className="itemContent">{item.name}</div>
            </div>
          </div>
        )}
      />
    </div>
  );
}

const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);
```

So the first thing is to create some data
```javascript
const data = [{ name: "hola" }];
for (let i = 0; i < 1000; i++) {
  data.push({ name: `Row ${i}` });
}
```
The next thing we implement a render method that use the list.

```javascript
 <VirtualList
        className="list"
        data={data}
        itemheight={50}
        renderItems={(item, index, style) => (
          <div className="itemRenderer" key={index} style={style}>
            <img
              className="itemImage"
              src="https://i.stack.imgur.com/4QkvN.jpg?s=64&g=1"
            />
            <div className="itemTitleContainer">
              <div className="itemTitle">{item.name}</div>
              <div className="itemContent">{item.name}</div>
            </div>
          </div>
        )}
      />
```


The list recive 3 params:
- data: Data is an array of elements to be render by the list
- itemheight: is the height of each item of the list
- renderItems: It is a hight order function where you can set what component is to be use to render the list elements.
  * The function recive the following params:
    * item:A element from the data object.
    * index:The cardinal order of the element, it positio in the data array.
    * style:The style to be applied to position the element. 
  * This function returns:
    * A react component.(Make sure you assign the style to the returning component so it get position properly)


## Other Free Apps we have created:
- [Profile Me](https://profile.softcloud.pro/) - Creates Professional Profile pictures.
- [Background RM](https://rmbackground.softcloud.pro/) - Remove pictures Background.
- [MetersApp](https://app.meters.app/login) - Create Quotes using measures from floorplan.

---
_Source: https://npm.io/package/react-vlist · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
