Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Apply 62 React and Next.js performance optimization rules from Vercel Engineering
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
rules/rendering-content-visibility.md
1---2title: CSS content-visibility for Long Lists3impact: HIGH4impactDescription: faster initial render5tags: rendering, css, content-visibility, long-lists6---78## CSS content-visibility for Long Lists910Apply `content-visibility: auto` to defer off-screen rendering.1112**CSS:**1314```css15.message-item {16content-visibility: auto;17contain-intrinsic-size: 0 80px;18}19```2021**Example:**2223```tsx24function MessageList({ messages }: { messages: Message[] }) {25return (26<div className="overflow-y-auto h-screen">27{messages.map(msg => (28<div key={msg.id} className="message-item">29<Avatar user={msg.author} />30<div>{msg.content}</div>31</div>32))}33</div>34)35}36```3738For 1000 messages, browser skips layout/paint for ~990 off-screen items (10× faster initial render).39