Repository navigation
Virtualized List
github-actions[bot] edited this page Nov 26, 2026
·
3 revisions
The virtual_list widget renders large datasets efficiently. It creates elements only for a window of items around the visible part. Items can have variable heights, and the flexbox layout sets their size.
use blinc::layout::widgets::virtual_list::virtual_list;
let items: Vec<String> = (0..10_000)
.map(|i| format!("Item {}", i))
.collect();
virtual_list(items.len(), move |index| {
div()
.w_full()
.p_px(8.0)
.flex_row()
.items_center()
.child(text(&items[index]).size(14.0).color(Color::WHITE))
})
.w_full()
.h(400.0)
.into_div()Items do not need a fixed height. Flexbox sets their size:
virtual_list(messages.len(), move |i| {
let msg = &messages[i];
div()
.w_full()
.p_px(12.0)
.flex_col()
.gap_px(4.0)
.child(text(&msg.author).size(12.0).bold().color(Color::WHITE))
.child(text(&msg.body).size(14.0).color(Color::rgba(0.8, 0.8, 0.8, 1.0)))
// Height is determined by content — short messages are small, long ones wrap
})
.w_full()
.h(600.0)
.into_div()virtual_list(count, builder)
.w_full() // Width
.h(400.0) // Viewport height
.bg(Color::BLACK) // Background
.rounded(8.0) // Corner radius
.estimated_item_height(48.0) // Height of a row not yet measured (default: 40px)
.window_size(80) // Rows to build, with those around the view (default: 50)
.gap_px(8.0) // Space between rows (default: 0)
.into_div()| Option | Default | Description |
|---|---|---|
estimated_item_height |
40.0 | Height that the list uses for a row that it did not measure yet |
window_size |
50 | Number of rows that the list builds, with the rows around the view |
gap_px |
0.0 | Space between rows, in pixels |
The list always builds all the visible rows. Their number can be more than window_size. To put space
between rows, use .gap_px(). The list does not measure the margin of a row.
- The list builds rows only for a window around the visible part.
- When you scroll, the window follows.
- The flexbox layout sets the height of each row, and the list measures it.
- A spacer above the window and a spacer below it stand for the other rows.
- The scroll container provides scrolling with momentum physics.
Getting Started
Migrating
Mobile Development
Example Gallery
- Example Gallery
- Canvas Element
- Canvas Kit Interactive
- Carousel Demo - Selector API Showcase
- Chrome-Style Tabs
- blinc_cn Components
- Run with
cargo run -p blinc_app_examples --features cn --example cn_pickers_demo. - Code Element
- Complex SVG
- CSS Debug
- CSS Visual Features
- Layer Effects
- Emoji and HTML Entities
- @flow Shader
- Fluid Surface
- Skeleton animation with glTF +
blinc_canvas_kit. - Gpu Pass Demo
- Image CSS Styling
- Image Layer Test
- Keyframe Animation Canvas
- Markdown Editor
- 3D Mesh Demo — renders the Khronos glTF
DamagedHelmetsample model - Motion Demo
- Music Player Glass Card
- Node-editor demo — pre-wired graph with three node types, typed
- Notch Menu Bar
- Overflow Fade
- Overlay System
- Pointer Query
- Rich Text Element
- Rich Text Editor
- Scroll Container
- Semantic @flow
- Sortable
- Stateful API + Signal-bound modifiers demo.
- End-to-end 3D demo wiring Blinc's SceneKit3D renderer up to
- Unified Styling API
- SVG Animation
- Table Builder
- Tabler Icons
- Minimal text positioning test
- Text Input Widgets
- KHR_texture_transform
- Theme System
- Timeline Animation
- Typography
- Wet Glass
- Windowed Application
Web Development
Core Concepts
- Elements & Layout
- Styling & Materials
- CSS Styling
- Theming
- Event Handling
- Accessibility
- State Management
- Lists & Conditional Content
- Element Refs
Animation
Components
Component Library (blinc_cn)
- Overview
- Button
- Card
- Icons
- Typography
- Dialog
- Form Components
- Date, Time and Colour Pickers
- Rich Text Editor
- Code Editor
- Navigation
- Feedback
- Layout
- Data Display
Widgets
- Buttons & Inputs
- Text & Rich Text
- Code Editor
- Scroll Containers
- Virtualized List
- Canvas Drawing
- Gestures
- Notched Surfaces
- Images & SVG
- Audio & Video
- Markdown Rendering
Canvas Kit
Advanced
- Routing & Navigation
- Multi-Window
- System Integration
- Element Query API
- Overlay System
- Custom State Machines
- Pointer Query
- Performance Tips
- Flow Shaders
- 3D Rendering
- Custom GPU Passes
- Hot reloading
Architecture
Contributing