Skip to main content

Vue 3 Infinite Scroll & Virtual List Component

Build a high-performance infinite scroll component with virtual rendering for Vue 3 — handles 100K+ items with smooth scrolling.

Fill in the placeholders

Edit the values, then copy your finished prompt.

Your Prompt
prompt.txt

                                

What this prompt does

This prompt asks the AI to build an infinite scroll component with virtual rendering for Vue 3 and TypeScript. It renders only [visible_buffer] items in the DOM regardless of total count ([total_items]+), supports dynamic row heights rather than fixed-height-only, and loads data through [data_source] integration. It shows loading skeletons while fetching, an error state with retry, scroll-position restoration on route change and browser back, and keyboard navigation with arrow keys, Page Up/Down, and Home/End.

The structure works because rendering tens of thousands of DOM nodes melts the browser, and virtual rendering — keeping only a small buffer mounted — is the only way large lists stay smooth. By exposing a typed useVirtualList composable and supporting both window and container scroll modes, the prompt produces something reusable, not a one-off. Accessibility live-region announcements and a frame-time target of [target_fps]ms keep it usable for everyone, with unit tests and a Storybook demo. Scroll-position restoration on route change and browser back is the detail that separates a polished list from a frustrating one, since losing the user's place after navigating away is exactly the kind of regression virtual lists tend to introduce.

When to use it

  • You are rendering long lists — feeds, tables, logs — and the browser stutters or freezes.
  • You have [total_items]+ rows and need only [visible_buffer] mounted at a time.
  • Your rows vary in height and fixed-height virtual lists won't work.
  • You need infinite loading wired to [data_source] like a cursor-paginated API.
  • You want scroll position preserved across navigation and browser back.
  • You want a reusable, typed useVirtualList composable rather than a bespoke component.

Example output

Expect a Vue 3 Composition API component plus a typed useVirtualList composable, rendering only [visible_buffer] items from a [total_items]+ dataset. You get dynamic row-height handling, [data_source] infinite loading, loading skeletons, error-with-retry, scroll restoration, keyboard navigation, live-region accessibility, unit tests, and a Storybook demo — targeting [target_fps]ms frame time.

Pro tips

  • Size [visible_buffer] to comfortably cover the viewport plus overscan; too small causes blank flashes on fast scroll, too large erodes the performance win.
  • Dynamic row heights are the hard part — verify measurement-and-cache logic, since wrong height estimates cause scroll jumps.
  • Match [data_source] to your real API; cursor-based pagination integrates more cleanly than offset for infinite scroll.
  • Test scroll restoration on actual route changes and browser back, not just refresh — that is where naive implementations lose position.
  • Treat the [target_fps]ms frame-time budget as a profiling target; measure with real data volume, since small test sets hide jank.
  • Do not skip the live-region announcements; screen-reader users otherwise have no signal that new content loaded.

Frequently Asked Questions

How many items does it actually render in the DOM?
Only `[visible_buffer]` items are mounted at any time, regardless of whether the total is `[total_items]` or far more. This is the core of virtual rendering — keeping the DOM node count small and constant is what allows smooth scrolling over very large datasets.
Does it support rows with different heights?
Yes. It supports dynamic row heights, not just fixed-height rows. This is the trickiest part of any virtual list, so verify the height measurement and caching logic carefully, since incorrect estimates are the usual cause of scroll-position jumps.
Can I reuse the logic outside this one component?
Yes. It exposes a typed `useVirtualList` composable with config options, so you can apply virtual rendering to your own markup. It also supports both window-scroll and container-scroll modes, which covers most layout situations you'll encounter.
Is it accessible to screen-reader and keyboard users?
It includes keyboard navigation (arrow keys, Page Up/Down, Home/End) and live-region announcements when new content loads. Do not remove the announcements, since virtual rendering otherwise gives assistive technology no signal that additional items have appeared.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

More in Vue.js & Angular Prompts

Engr Mejba Ahmed

Engr Mejba Ahmed

Claude Code Expert · Online

👋

Hey there!

Quick Actions

WhatsApp Instant reply

Chat on WhatsApp

+880 1723 741224 · Instant reply

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

[email protected]

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support