All Projects β†’ rocwang β†’ vue-virtual-scroll-grid

rocwang / vue-virtual-scroll-grid

Licence: MIT License
A Vue 3 component that can render a list with 1000+ items as a grid in a performant way.

Programming Languages

Vue
7211 projects
typescript
32286 projects
CSS
56736 projects
javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to vue-virtual-scroll-grid

React Ingrid
React infinite grid
Stars: ✭ 59 (-7.81%)
Mutual labels:  grid, infinite-scroll
React Tiny Virtual List
A tiny but mighty 3kb list virtualization library, with zero dependencies πŸ’ͺ Supports variable heights/widths, sticky items, scrolling to index, and more!
Stars: ✭ 2,057 (+3114.06%)
Mutual labels:  windowing, virtual-scroll
react-virtual-scroller
A react implementation of twitter VirtualScroller.
Stars: ✭ 43 (-32.81%)
Mutual labels:  infinite-scroll, virtual-scroll
React Virtualized
React components for efficiently rendering large lists and tabular data
Stars: ✭ 22,963 (+35779.69%)
Mutual labels:  grid, windowing
Revogrid
Powerful virtual data grid smartsheet with advanced customization. Best features from excel plus incredible performance πŸ”‹
Stars: ✭ 1,870 (+2821.88%)
Mutual labels:  grid, virtual-scroll
Reactables
GigaTables is a ReactJS plug-in to help web-developers process table-data in applications and CMS, CRM, ERP or similar systems.
Stars: ✭ 112 (+75%)
Mutual labels:  grid, infinite-scroll
aurelia-virtual-scroll
Aurelia Virtual Scroller
Stars: ✭ 15 (-76.56%)
Mutual labels:  grid, windowing
simple-grid-system
A CSS Flexbox grid system for web page . Easy to use it !!
Stars: ✭ 15 (-76.56%)
Mutual labels:  grid
ReactSimpleFlexGrid
A way to quickly add a Grid Layout to your React app πŸš€
Stars: ✭ 185 (+189.06%)
Mutual labels:  grid
Fluid-Grid
Fluid, Responsive and Semantic grid for Sass (SCSS) or LESS CSS. Supports any number of columns. Gutter width is defined as percentage, and grids can be nested too.
Stars: ✭ 17 (-73.44%)
Mutual labels:  grid
atomic-bulldog-grid
🏒 CSS (SCSS) Grid based on CSS grid layout with @supports fallback to flexbox
Stars: ✭ 94 (+46.88%)
Mutual labels:  grid
grd-sass
Sass port of 1000ch/grd that is a CSS grid framework using Flexbox.
Stars: ✭ 12 (-81.25%)
Mutual labels:  grid
vue-grid
A powerful flexbox grid system for Vue.js 2.x, built with inline-styles
Stars: ✭ 23 (-64.06%)
Mutual labels:  grid
LimberGridView
LimberGridView, a powerful JavaScript Library using Computational Geometry to render movable, dynamically resizable, and auto-arranging grids. Written in vanilla JavaScript, it can be plugged into most frameworks, plus it has a plugin for React applications. It gives users the most optimal arrangements using its highly efficient and fine-tuned a…
Stars: ✭ 51 (-20.31%)
Mutual labels:  grid
react-native-bidirectional-infinite-scroll
πŸ“œ React Native - Bidirectional Infinite Smooth Scroll
Stars: ✭ 137 (+114.06%)
Mutual labels:  infinite-scroll
BlazorGrid
A simple, light weight data grid component for Blazor, focused on displaying remote data. Supports sorting and row highlighting, dynamic column changes and custom cell markup.
Stars: ✭ 61 (-4.69%)
Mutual labels:  grid
workshop-css-grid
Workshop made for freecodecamp meetup
Stars: ✭ 12 (-81.25%)
Mutual labels:  grid
vue-smart-widget
πŸ—ƒοΈSmart widget is a flexible and extensible content container component for Vue2.x / Vue3.x in Next branch.
Stars: ✭ 110 (+71.88%)
Mutual labels:  grid
jui-grid
JUI grid can handle millions of data, and can display the data in a hierarchical structure.
Stars: ✭ 12 (-81.25%)
Mutual labels:  grid
jekyll-grid
Jekyll theme (used on 25x52.com) displays posts in a grid. Ideal for projects
Stars: ✭ 63 (-1.56%)
Mutual labels:  grid

Virtual Scroll Grid for Vue 3

This is a reusable component for Vue 3 that renders a list with a huge number of items (e.g. 1000+ items) as a grid in a performant way.

Features

  • Use virtual-scrolling / windowing to render the items, so the number of DOM nodes is kept low.
  • Just use CSS grid to style your grid. Minimum styling opinions form the library.
  • Support using a paginated API to load the items in the background.
  • Support rendering placeholders for unloaded items
  • Loaded items are cached for better performance.

Code Examples

Install

npm install vue-virtual-scroll-grid

Available Props

Name Description Type Validation
length The number of items in the list number Required, an integer greater than or equal to 0
pageProvider The callback that returns a page of items as a promise (pageNumber: number, pageSize: number) => Promise<unknown[]> Required
pageProviderDebounceTime Debounce window in milliseconds on the calls to pageProvider number Optional, an integer greater than or equal to 0
pageSize The number of items in a page from the item provider (e.g. a backend API) number Required, an integer greater than or equal to 1
scrollTo Scroll to a specific item by index number Optional, an integer from 0 to the length prop - 1

Example:

<Grid
  :length="1000"
  :pageProvider="async (pageNumber, pageSize) => Array(pageSize).fill('x')"
  :pageSize="40"
  :scrollTo="10"
>
  <!-- ...slots -->
</Grid>

Available Slots

There are 3 scoped slots: default, placeholder and probe.

The default slot

The default slot is used to render a loaded item.

Props:

  • item: the loaded item that is used for rendering your item element/component.
  • index: the index of current item within the list.
  • style: the style object provided by the library that need to be set on the item element/component.

Example:

<template v-slot:default="{ item, style, index }">
  <div :style="style">{{ item }} {{ index }}</div>
</template>

Theplaceholder slot

When an item is not loaded, the component/element in the placeholder slot will be used for rendering. The placeholder slot is optional. If missing, the space of unloaded items will be blank until they are loaded.

Props:

  • index: the index of current item within the list.
  • style: the style object provided by the library that need to be set on the item element/component.

Example:

<template v-slot:placeholder="{ index, style }">
  <div :style="style">Placeholder {{ index }}</div>
</template>

The probe slot

The probe slot is used to measure the visual size of grid item. It has no prop. You can pass the same element/component for the placeholder slot. If not provided, you must set a fixed height to grid-template-rows on your CSS grid, e.g. 200px. If provided, make sure it is styled with the same dimensions as rendered items in the default or placeholder slot. Otherwise, the view wouldn't be rendered properly, or the rendering could be very slow.

Example:

<template v-slot:probe>
  <div class="item">Probe</div>
</template>

Caveats

The library does not require items have foreknown width and height, but do require them to be styled with the same width and height under a view. E.g. the items can be 200px x 200px when the view is under 768px and 300px x 500px above 768px.

Development

Required environment variables:

  • VITE_APP_ID: An Algolia app ID
  • VITE_SEARCH_ONLY_API_KEY: The search API key for the Algolia app above
  • Setup: npm install
  • Run dev server: npm run dev
  • Lint (type check): npm run lint
  • Build the library: npm run build
  • Build the demo: npm run build -- --mode=demo
  • Preview the locally built demo: npm run serve

How to Release a New Version

We use semantic-release to release the library on npm automatically.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].