Virtualize
inferencesh/virtualizeFreeBlock
Typed virtualization with measurement strategies, incremental caching, and scroll correction.
Live preview
live · rendered by the registry
Rendered by inferencesh on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://ui.inference.sh/r/virtualize.jsonSource
1export type MeasureStrategy =2 | FixedStrategy3 | CappedStrategy4 | ComputedStrategy56// Height is always the same regardless of content or width.7// Examples: buttons, pills, status indicators, headers.8export type FixedStrategy = {9 kind: 'fixed'10 height: number11}1213// Content scrolls inside a capped container.14// Height is min(estimatedContent, maxHeight).15// Examples: JSON preview, log viewer, reasoning block.16export type CappedStrategy = {17 kind: 'capped'18 maxHeight: number19 // If you can estimate content height cheaply (e.g. lineCount * lineHeight),20 // provide it. Otherwise the cap is used as the height.21 estimateContent?: number22}2324// Height is deterministic from props — pure arithmetic, no DOM.25// Examples: list of N items × row height, grid of N columns.26export type ComputedStrategy = {27 kind: 'computed'28 measure: (width: number) => number29}3031// --- Virtualisable item ---3233export type VirtualItem<T = unknown> = {34 id: string | number35 strategy: MeasureStrategy36 data: T37}3839// --- Resolved item (after measurement) ---4041export type PositionedItem<T = unknown> = {42 id: string | number43 data: T44 height: number45 y: number46}
Files it writes
More from inferencesh
All 14 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Agent Chatagent | inferencesh | Blocks | Free | 1 dep | |
| Chat UI Primitiveschat | inferencesh | Blocks | Free | 1 dep · 15 files | |
| Code Blockcode-block | inferencesh | Blocks | Free | no deps · 7 files | |
| Markdown Renderer (legacy)markdown | inferencesh | Blocks | Free | 2 deps · 2 files | |
| pretext-mdpretext-md | inferencesh | Blocks | Free | 4 deps · 10 files | |
| Sidebar Lightsidebar-light | inferencesh | Blocks | Free | no deps | |
| Stepssteps | inferencesh | Blocks | Free | no deps · 2 files | |
| Table of Contentstable-of-contents | inferencesh | Blocks | Free | no deps |
