Render thousands of items with only the visible ones in the DOM. The component emits bp-virtual-change events when the visible range changes, allowing you to render only what's needed.
Use the scrollToIndex() method to programmatically scroll to any item in the list. Supports both instant and smooth scrolling.
// Instant jump to item 500
list.scrollToIndex(500);// Smooth scroll to item 500
list.scrollToIndex(500,'smooth');// Back to top
list.scrollToIndex(0,'smooth');
Jump to 500Smooth to 500Back to top
API
Properties / Attributes
Property
Attribute
Type
Default
Description
itemHeight
item-height
number
44
Fixed height per item in pixels
itemCount
item-count
number
0
Total items in dataset
itemBuffer
item-buffer
number
1
Buffer items outside viewport
height
height
string
'auto'
Container height (CSS value)
Events
Event
Detail
Description
bp-virtual-change
{ start, end, count }
Visible range updated
bp-virtual-scroll
{ scrollTop, direction }
Scroll position changed
Commands
Command
Description
--scroll-to-index
Scroll to item at index based on the value of the source button issuing the command