0.6.3 • Published 2 months ago

svelte-virtual v0.6.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

svelte-virtual

About

Svelte components for efficiently rendering large lists. Instead of rendering all your data, svelte-virtual renders only what's visible

⚠️ New releases

New versions were released under the next release tag. Install it for new features and bug fixes.

Installation

With npm:

npm i -D svelte-virtual@next

With yarn:

yarn add -D svelte-virtual@next

With pnpm:

pnpm add -D svelte-virtual@next

@next docs


v0.6.3 Usage

Vertical List default

<script>
	import { List } from "svelte-virtual";

	let items = [...Array(100000).keys()];
</script>

<List itemCount={items.length} itemSize={20} height={500}>
	<div slot="item" let:index let:style {style}>
		{items[index]}
	</div>
</List>

Horizontal List (demo)

<script>
	import { List } from "svelte-virtual";

	let items = [...Array(100000).keys()];
</script>

<List itemCount={items.length} itemSize={60} height={40} layout="horizontal">
	<div slot="item" let:index let:style {style}>
		{items[index]}
	</div>
</List>

Grid (demo)

<script>
	import { Grid } from "svelte-virtual";

	let items = [...Array(100000).keys()];
</script>

<Grid itemCount={items.length} itemHeight={50} itemWidth={60} height={500}>
	<div slot="item" let:index let:style {style}>
		{items[index]}
	</div>
</Grid>

Props

List

PropertyTypeDefaultRequired?
itemCountnumber
itemSizenumber
heightnumber
widthstring"100%"
overScannumber1
marginLeftnumber0
marginTopnumber0
layout"vertical" \| "horizontal""vertical"
scrollToIndexnumber \| undefinedundefined
scrollToPositionnumber \| undefinedundefined
scrollToBehavior"auto" \| "smooth""auto"

Grid

PropertyTypeDefaultRequired?
itemCountnumber
itemHeightnumber
itemWidthnumber
heightnumber
widthstring"100%"
overScannumber1
marginLeftnumber0
marginTopnumber0
scrollToIndexnumber \| undefinedundefined
scrollToPositionnumber \| undefinedundefined
scrollToBehavior"auto" \| "smooth""auto"

Methods (demo)

PropertyArguments
scrollTo.indexindex: number
scrollTo.positionposition: number

Slots

  • item - Slot for each item
    • Props:
      • index: number - Item index
      • scrollPosition: number - Item scroll position in the list
      • style: string - Item style, must be applied to the slot (look above for example)
  • header - Slot for the elements that should appear at the top of the component
  • footer - Slot for the elements that should appear at the bottom of the component

License

MIT

0.6.3

2 months ago

1.0.0-next.17

3 months ago

1.0.0-next.16

9 months ago

1.0.0-next.15

11 months ago

1.0.0-next.14

11 months ago

1.0.0-next.11

1 year ago

1.0.0-next.10

1 year ago

1.0.0-next.13

1 year ago

1.0.0-next.12

1 year ago

1.0.0-next.5

1 year ago

1.0.0-next.6

1 year ago

1.0.0-next.7

1 year ago

1.0.0-next.8

1 year ago

1.0.0-next.9

1 year ago

1.0.0-next.0

1 year ago

1.0.0-next.1

1 year ago

1.0.0-next.2

1 year ago

1.0.0-next.3

1 year ago

1.0.0-next.4

1 year ago

0.6.2

1 year ago

0.6.1

1 year ago

0.6.0

1 year ago

0.5.3-beta

2 years ago

0.5.1-beta

2 years ago

0.5.0-beta

2 years ago

0.4.6-alpha

2 years ago

0.4.5-alpha

2 years ago

0.4.4-alpha

2 years ago

0.4.3-alpha

2 years ago

0.4.2-alpha

2 years ago

0.4.1-alpha

2 years ago

0.4.0-alpha

2 years ago

0.3.0-alpha

2 years ago

0.2.0-alpha

2 years ago

0.1.1-alpha

2 years ago

0.1.0-alpha

2 years ago

0.0.2-alpha

2 years ago

0.0.1-alpha

2 years ago

0.0.0

2 years ago

0.0.1

2 years ago