You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Improve component typings
- Add svelte-check tool to verify typings
- Improve performance and simplify SizeAndPositionManager
- Deprecate `children` snippet and use `item` instead
- Deprecate `onListItemsUpdate` and use `onItemsUpdated` instead
- Bring back some old types that are now migrated to Svelte 5
- Actually export the correct types
- Don't use $state for bind:this
- Change `height` default to `'100%'`
- Get rid of Element.scroll fallback since older browsers are not supported anymore anyways
| width |`number \| string`| ✓ | Width of List. This property will determine the number of rendered items when scrollDirection is `'horizontal'`. |
113
-
| height |`number \| string`| ✓ | Height of List. This property will determine the number of rendered items when scrollDirection is `'vertical'`. |
114
-
| itemCount |`number`|✓| The number of items you want to render|
115
-
| itemSize |`number \| number[] \| (index: number) => number`|✓| Either a fixed height/width (depending on the scrollDirection), an array containing the heights of all the items in your list, or a function that returns the height of an item given its index: `(index: number): number`|
116
-
| scrollDirection |`string`|| Whether the list should scroll vertically or horizontally. One of `'vertical'` (default) or `'horizontal'`. |
117
-
| scrollOffset |`number`|| Can be used to control the scroll offset; Also useful for setting an initial scroll offset|
118
-
| scrollToIndex |`number`|| Item index to scroll to (by forcefully scrolling if necessary)|
119
-
| scrollToAlignment |`string`||Used in combination with `scrollToIndex`, this prop controls the alignment of the scrolled to item. One of: `'start'`, `'center'`, `'end'` or `'auto'`. Use `'start'`to always align items to the top of the container and `'end'` to align them bottom. Use `'center`' to align them in the middle of the container. `'auto'` scrolls the least amount possible to ensure that the specified `scrollToIndex` item is fully visible. |
120
-
| scrollToBehaviour |`string`|| Used in combination with `scrollToIndex`, this prop controls the behaviour of the scrolling. One of: `'auto'`, `'smooth'` or `'instant'` (default). |
121
-
| stickyIndices |`number[]`|| An array of indexes (eg. `[0, 10, 25, 30]`) to make certain items in the list sticky (`position: sticky`)|
122
-
| overscanCount |`number`|| Number of extra buffer items to render above/below the visible items. Tweaking this can help reduce scroll flickering on certain browsers/devices.|
123
-
| estimatedItemSize |`number`|| Used to estimate the total size of the list before all of its items have actually been measured. The estimated total height is progressively adjusted as items are rendered.|
124
-
| getKey |`(index: number) => any`|| Function that returns the key of an item in the list, which is used to uniquely identify an item. This is useful for dynamic data coming from a database or similar. By default, it's using the item's index.|
125
-
| onAfterScroll |`({ event: ScrollEvent, offset: number }) => void`|| Function that fires after handling the scroll event. Props: `event: ScrollEvent` - The original scroll event, `offset: number` - Either the value of `wrapper.scrollTop` or `wrapper.scrollLeft`|
126
-
| onListItemsUpdate |`({ start: number, end: number }) => void`|| Function that fires when the visible items are updated. Props: `start: number` - Index of the first visible item, `end: number` - Index of the last visible item.|
| width |`number \| string`|REQUIRED or `'100%'`| Width of the list view box. When `scrollDirection` is `'horizontal'`, this property is required to be a `number` and determines the number of rendered items.|
113
+
| height |`number \| string`|REQUIRED or `'100%'`| Height of the list view box. When `scrollDirection` is `'vertical'`, this property is required to be a `number` and determines the number of rendered items.|
114
+
| itemCount |`number`|REQUIRED| The number of items you want to render.|
115
+
| itemSize |`number \| number[] \| (index: number) => number`|REQUIRED| Either a fixed height/width (depending on the `scrollDirection`), an array containing the heights of all the items in your list, or a function that returns the height of an item given its index: `(index: number) => number`.|
116
+
| scrollDirection |`'vertical' \| 'horizontal'`|`'vertical'`| Whether the list should scroll vertically or horizontally. |
117
+
| scrollOffset |`number`|`0`| Used to control the scroll offset, but also useful for setting an initial scroll offset.|
118
+
| scrollToIndex |`number`|`-1`| Item index to scroll to (by forcefully scrolling if necessary).|
119
+
| scrollToAlignment |`'start' \| 'center' \| 'end' \| 'auto'`|`'start'`|Used in combination with `scrollToIndex`, this prop controls the alignment of the scrolled to item. Use `'auto'`to scroll the least amount required to ensure that the specified `scrollToIndex` item is fully visible.|
120
+
| scrollToBehaviour |`'smooth' \| 'instant' \| 'auto'`|`'instant'`| Used in combination with `scrollToIndex`, this prop controls the behaviour of the scrolling. See: [Element: scroll() method - Web APIs| MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/scroll#behavior).|
121
+
| stickyIndices |`number[]`|`[]`| An array of indexes (eg. `[0, 10, 25, 30]`) to make certain items in the list sticky (`position: sticky`) |
122
+
| overscanCount |`number`|`3`| Number of extra buffer items to render above/below the visible items. Tweaking this can help reduce scroll flickering on certain browsers/devices. |
123
+
| estimatedItemSize |`number`|`0`| Used to estimate the total size of the list before all of its items have actually been measured. The estimated total height is progressively adjusted as items are rendered. |
124
+
| getKey |`((index: number) => any) \| null`|`undefined`| Function that returns the key of an item in the list, which is used to uniquely identify an item. This is useful for dynamic data coming from a database or similar. By default, it's using the item's index. |
125
+
| onAfterScroll |`({ event: ScrollEvent, offset: number }) => void`|`undefined`| Function that fires after handling the scroll event. Props: `event: ScrollEvent` - The original scroll event, `offset: number` - Either the value of `wrapper.scrollTop` or `wrapper.scrollLeft`|
126
+
| onListItemsUpdate |`({ start: number, end: number }) => void`|`undefined`| Function that fires when the visible items are updated. Props: `start: number` - Index of the first visible item, `end: number` - Index of the last visible item. |
127
127
128
128
### Snippets
129
129
@@ -221,4 +221,4 @@ You can style the elements of the virtual list like this:
0 commit comments