ux-css-layout
Skill196k starsChanged 17 days agoMITView on GitHub
VS Code CSS conventions, SplitView/Grid layout, semantic sizes, rounded-surface geometry, clipping, scrollable content, and text overflow. Use when writing CSS, building layouts, or fixing corners, panel gaps, or text truncation.
Trending
More talk lately.about the whole repository
Who's talking about microsoft/vscode
- A Hacker News story“VS Code inserting 'Co-Authored-by Copilot' into commits regardless of usage”Hacker News · May 2, 2026 · 1.5k points
- microsoft/TypeScript“Convert the codebase to modules”GitHub · Nov 2, 2022 · 1.3k reactions
- A Hacker News story“VS Code uses 13% CPU when idle due to blinking cursor rendering”Hacker News · Mar 23, 2017 · 899 points
- A Hacker News story“VS Code Roadmap 2018”Hacker News · Nov 1, 2017 · 360 points
- microsoft/vscode-python“Fix environment-dependent git pre-commit hooks”GitHub · Feb 18, 2020 · 338 reactions
The biggest 5 of 96 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 96
Talked about on Bluesky, Hacker News and GitHub (96 times).
On Bluesky · 48
- Jan 18, 2026Decided to quit being hard headed and just do what everyone else is doing/has done. — @advanced-eschatonics.com12 likes and reposts · 1 reply
- Jul 12, 2026📦 microsoft / vscode ⭐ 187,428 (+52) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social3 likes and reposts
- Jul 2, 2026📦 microsoft / vscode ⭐ 186,897 (+73) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social3 likes and reposts
- Nov 2, 2025📦 microsoft / vscode ⭐ 178,121 (+34) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social3 likes and reposts
- Jan 15, 2025📦 microsoft / vscode ⭐ 166,156 (+43) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social3 likes and reposts
43 more on Bluesky
- Jul 8, 2023📦 microsoft / vscode ⭐ 147,967 (+41) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social3 likes and reposts
- Apr 5, 2026📦 microsoft / vscode ⭐ 183,440 (+45) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social2 likes and reposts
- Jul 18, 2025Sorry to hear you are hitting this problem! We would love to help you out over at github.com/microsoft/vs... and if you assign your issue… — @eleanor-py.bsky.social2 likes and reposts
- May 21, 2025🚀 Skyrocketing! 🚀 (200+ new stars) 📦 microsoft / vscode ⭐ 171,731 (+283) 🗒 TypeScript Visual Studio Code — @github-trending.bsky.social2 likes and reposts
- May 20, 2025🚀 Skyrocketing! 🚀 (200+ new stars) 📦 microsoft / vscode ⭐ 171,513 (+253) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social2 likes and reposts · 1 reply
- Mar 30, 2025📦 microsoft / vscode ⭐ 169,312 (+41) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social2 likes and reposts
- Mar 7, 2025📦 microsoft / vscode ⭐ 168,219 (+82) 🗒 TypeScript Visual Studio Code — @github-trending.bsky.social2 likes and reposts
- Feb 12, 2025📦 microsoft / vscode ⭐ 167,217 (+56) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social2 likes and reposts
- Feb 8, 2025📦 microsoft / vscode ⭐ 167,047 (+49) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social2 likes and reposts
- Jan 24, 2025📦 microsoft / vscode ⭐ 166,533 (+32) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social2 likes and reposts
- Jan 15, 2025📦 microsoft / vscode ⭐ 166,156 (+43) 🗒 TypeScript Visual Studio Code — @github-trending.bsky.social2 likes and reposts
- Sep 1, 2024📦 microsoft / vscode ⭐ 162,015 (+32) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social2 likes and reposts
- Jun 10, 2024📦 microsoft / vscode ⭐ 159,629 (+49) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social2 likes and reposts
- Aug 26, 2023🔥 Hot Repo! 🔥 (100+ new stars) 📦 microsoft / vscode ⭐ 150,079 (+137) 🗒 TypeScript Visual Studio Code — @github-trending.bsky.social2 likes and reposts · 1 reply
- Nov 7, 2026🚀 Skyrocketing! 🚀 (200+ new stars) 📦 microsoft / vscode ⭐ 194,788 (+295) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost · 1 reply
- Nov 6, 2026🚀 Skyrocketing! 🚀 (200+ new stars) 📦 microsoft / vscode ⭐ 194,788 (+295) 🗒 TypeScript Visual Studio Code — @github-trending.bsky.social1 likes and repost · 1 reply
- Sep 26, 2026📦 microsoft / vscode ⭐ 192,963 (+78) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost
- Sep 26, 2026📦 microsoft / vscode ⭐ 192,963 (+78) 🗒 TypeScript Visual Studio Code — @github-trending.bsky.social1 likes and repost
- Jun 25, 2026🔥 Hot Repo! 🔥 (100+ new stars) 📦 microsoft / vscode ⭐ 186,883 (+192) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost
- Jun 4, 2026🔥 Hot Repo! 🔥 (100+ new stars) 📦 microsoft / vscode ⭐ 185,791 (+129) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost
- May 20, 2026📦 microsoft / vscode ⭐ 185,087 (+57) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost
- Apr 16, 2026📦 microsoft / vscode ⭐ 183,924 (+72) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost
- Mar 5, 2026📦 microsoft / vscode ⭐ 182,312 (+76) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost
- Dec 28, 2025📦 microsoft / vscode ⭐ 180,078 (+53) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost
- Jul 2, 2025📦 microsoft / vscode ⭐ 174,099 (+53) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost
- May 24, 2025🚀 Skyrocketing! 🚀 (200+ new stars) 📦 microsoft / vscode ⭐ 172,520 (+306) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost
- May 8, 2025📦 microsoft / vscode ⭐ 170,885 (+85) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost
- Apr 11, 2025📦 microsoft / vscode ⭐ 169,887 (+76) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost
- Apr 7, 2025📦 microsoft / vscode ⭐ 169,634 (+51) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost
- Mar 6, 2025📦 microsoft / vscode ⭐ 168,138 (+89) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost
- Feb 16, 2025📦 microsoft / vscode ⭐ 167,406 (+60) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost
- Jan 2, 2025lol yeah vscode is kinda wild tbh github.com/microsoft/vscode is the open source project but the versions you get from… — @benharri.org1 likes and repost · 2 replies
- Nov 1, 2024📦 microsoft / vscode ⭐ 163,956 (+52) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost
- Jun 18, 2024📦 microsoft / vscode ⭐ 159,805 (+32) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost
- Jun 6, 2024📦 microsoft / vscode ⭐ 159,414 (+58) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost
- Apr 11, 2024📦 microsoft / vscode ⭐ 157,765 (+42) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost
- Jan 29, 2024📦 microsoft / vscode ⭐ 155,349 (+36) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost
- Jan 19, 2024📦 microsoft / vscode ⭐ 155,009 (+57) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost
- Dec 24, 2023📦 microsoft / vscode ⭐ 154,283 (+39) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social1 likes and repost
- Mar 17, 2025Something I just realized I want: wikilinks but for any website; kinda like DDG bangs, but for linking to things more easily. Generally… — @blakes.dev0 likes and reposts · 1 reply
- Feb 16, 2024🚀 Skyrocketing! 🚀 (200+ new stars) 📦 microsoft / vscode ⭐ 156,140 (+203) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social0 likes and reposts · 1 reply
- Sep 4, 2023🔥 Hot Repo! 🔥 (100+ new stars) 📦 microsoft / vscode ⭐ 150,693 (+178) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social0 likes and reposts · 1 reply
- Aug 26, 2023🔥 Hot Repo! 🔥 (100+ new stars) 📦 microsoft / vscode ⭐ 150,078 (+137) 🗒 TypeScript Visual Studio Code — @github-trending-js.bsky.social0 likes and reposts · 1 reply
On Hacker News · 39
- May 2, 2026VS Code inserting 'Co-Authored-by Copilot' into commits regardless of usage1.5k points · 850 comments
- Mar 23, 2017VS Code uses 13% CPU when idle due to blinking cursor renderingsays it tested it899 points · 760 comments
- Nov 1, 2017VS Code Roadmap 2018360 points · 230 comments
- Dec 19, 2019Santa hat removed from VS Code after complaint243 points · 157 comments
- Apr 18, 2017Show HN: Visual Studio Code for ARM, submitted to core236 points · 83 comments
34 more on Hacker News
- Feb 8, 2026Billing can be bypassed using a combo of subagents with an agent definition213 points · 122 comments
- Oct 27, 2023Microsoft: Require user consent before sending any telemetry128 points · 122 comments
- May 29, 2020Insider Build of VSCode for Windows/ARM64106 points · 79 comments
- May 6, 2026Update on "Co-authored-by: Copilot" in commit messages102 points · 66 comments
- Dec 20, 2019Visual Studio Code repository is open again87 points · 163 comments
- Jun 19, 2018Want free VS Code? Build it from source84 points · 65 comments
- Oct 21, 2020Issue Grooming81 points · 68 comments
- Sep 25, 2026Bug: Border radius has infected VSCode editor80 points · 53 comments
- Mar 19, 2022Visual Studio Code is randomly erasing included header files with latest update75 points · 44 comments
- Sep 3, 2023VSCode Removes Twitter Integration68 points · 31 comments
- Oct 15, 2017New VS Code icon is ugly66 points · 48 comments
- Feb 4, 2023Microsoft mangles VS Code protected properties to prevent UI customization65 points · 28 comments
- Apr 29, 2020VS Code was lost on shutdown with pending update (2018)64 points · 90 comments
- Oct 27, 2025Severe performance penalty found in VSCode rendering loop63 points · 45 comments
- Nov 24, 2020VSCode memory leak issue marked “out-of-scope”62 points · 71 comments
- Feb 16, 2021Visual Studio Code team considers Vim mode depending on upvotes56 points · 27 comments
- Nov 3, 2023VS Code Introduces Floating Windows Support - The Most Requested Feature Ever46 points · 10 comments
- Jan 29, 2019VS Code Roadmap 201933 points · 3 comments
- Apr 21, 2022VS Code Development Process27 points · 3 comments
- Feb 2, 2024VSCode stopped supporting an old glibc version and near EOL users are in trouble23 points · 8 comments
- Jul 11, 2024VSCode won't start on several Mac OS versions, broken over a week16 points · 3 comments
- Nov 15, 2025Markdown files are not openable because of GitHub Copilot11 points · 1 comment
- Mar 17, 2022VSCode creates many empty file with invalid code automatically8 points · 1 comment
- Dec 19, 2019VS Code Issue Tracker Meltdown8 points · 4 comments
- Aug 31, 2023VSCode, have you collaborated with China?7 points
- Mar 15, 2023VS Code Monitors Full Command Line, CPU, Memory Usage of All Processes7 points · 1 comment
- Nov 20, 2024Thing Deleted 3 Months of Work6 points · 4 comments
- Nov 3, 2024VSCode high CPU usage issue affecting macOS6 points
- Oct 9, 2026VSCode silently switches to Microsoft models, ignoring BYO agent configuration5 points · 1 comment
- May 28, 2026VSCode fires up screen recording5 points
- Oct 5, 2025Microsoft Accidentally removes extensions from VSCode Marketplace5 points · 1 comment
- Nov 2, 2023After 7 years, VS Code finally implements preview support for floating windows5 points · 2 comments
- Feb 27, 2020THIS THING DELETED 3 MONTHS OF WORK!!!!5 points · 5 comments
- Dec 20, 2019VS Code is getting flak for removing Santa hat emoji5 points · 7 comments
On GitHub · 9
- Nov 2, 2022Convert the codebase to modules — microsoft/TypeScript1.3k reactions · 56 comments
- Feb 18, 2020Fix environment-dependent git pre-commit hooks — microsoft/vscode-python338 reactions · 57 comments
- Dec 12, 2025Handle writes to non-blocking pty instead of wrapping via Node's tty api — microsoft/node-pty256 reactions · 5 comments
- Oct 31, 2016Add Windows support and first-class Linux support — vercel/hyper160 reactions · 98 comments
- Sep 11, 2024Proposed expandable hover API — microsoft/TypeScript99 reactions · 15 comments
4 more on GitHub
- Dec 22, 2020LSP 3.16.0 — neoclide/coc.nvim64 reactions · 52 comments
- Mar 8, 2021Import statement completions — microsoft/TypeScript47 reactions · 9 comments
- Aug 13, 2017Feature/simple fullscreen mode — electron/electron43 reactions · 8 comments
- May 30, 2018Add support for grid layout — VSCodeVim/Vim37 reactions · 18 comments
In this repository96 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .eslint-plugin-local/AGENTS.mdAGENTS.md
- extensions/copilot/assets/prompts/skills/agent-customization/references/agents.mdAGENTS.md
- extensions/copilot/src/extension/chatSessions/copilotcli/AGENTS.mdAGENTS.md
- extensions/copilot/src/platform/authentication/common/AGENTS.mdAGENTS.md
- src/vs/platform/agentHost/AGENTS.mdAGENTS.md
- src/vs/platform/agentHost/common/state/AGENTS.mdAGENTS.md
- src/vs/platform/agentHost/node/copilot/prompts/AGENTS.mdAGENTS.md
- src/vs/platform/agentHost/test/node/AGENTS.mdAGENTS.md
- src/vs/workbench/contrib/imageCarousel/AGENTS.mdAGENTS.md
- extensions/copilot/.github/copilot-instructions.mdCopilot instructions
- .github/copilot-instructions.mdCopilot instructions
- launchSkill
- github-copilot-upgraderSkill
- launchSkill
- agent-customizationSkill
- chronicleSkill
- create-agentSkill
- create-canvasSkill
- create-hookSkill
- create-instructionsSkill
- create-promptSkill
- create-skillSkill
- initSkill
- migrate-customizationsSkill
- record-videoSkill
- troubleshootSkill
- accessibilitySkill
- agent-host-chat-contributionsSkill
- agent-host-e2e-testsSkill
- agent-host-logsSkill
- author-contributionsSkill
- auto-perf-optimizeSkill
- azure-pipelinesSkill
- build-champ-triageSkill
- chat-customizations-editorSkill
- chat-perfSkill
- chat-pet-sprite-creationSkill
- ci-artifact-testingSkill
- codenotifySkill
- code-oss-logsSkill
- code-reviewSkill
- component-fixturesSkill
- componentSkill
- context-menusSkill
- cpu-profile-analysisSkill
- customizations-in-the-agent-hostSkill
- design-philosophySkill
- doc-commentsSkill
- endgame-statusSkill
- experimentsSkill
- feature-tryoutsSkill
- feedback-learningSkill
- fix-ci-failuresSkill
- fixissuenoSkill
- flaky-smoke-testsSkill
- heap-snapshot-analysisSkill
- hoverSkill
- integrated-browserSkill
- integration-testsSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
21 rules. About 0 are common, 13 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈13
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 24
Import CSS directly in the TS file:
- Distinctive: line 79
Test geometry invalidation on the existing instance.
- Very specific: line 106
Use LayoutPriority.High / .Low to control which views resize first when space is constrained.
- Distinctive: line 138
Keep scroll handlers lightweight: batch layout reads before writes, coalesce duplicate measurements, and skip unchanged CSSOM writes.
- Distinctive: line 142
Verify actual scrollbar dragging and pointer acquisition after changing margins or clipping.
- Distinctive: line 153
When building a responsive component:
- Very specific: line 155
Use LayoutPriority.Low for panels that should collapse first.
- Very specific: line 156
Use snap: true for panels that should snap closed when too small.
- Very specific: line 161
Keep grid allocation, CSS margins/borders, and child-content dimensions consistent.
- Distinctive: line 162
Read current viewport and density state during layout rather than relying solely on constructor-selected behavior.
- Distinctive: line 163
Use existing screen-aware sizing helpers and the target window's effective pixel ratio for fractional scaling.
- Distinctive: line 164
Keep startup/restored geometry aligned with runtime layout, including missing-state fallbacks.
- Distinctive: line 165
Keep inter-panel spacing separate from pane-internal padding, exterior gutters, and the frame's reserved stroke.
- Distinctive: line 177
All text labels that can be truncated by a resizable container must use the ellipsis pattern.
- Distinctive: line 234
When a row has both fixed-size elements (icons, action buttons) and flexible text:
- Very specific: line 261
When text is truncated with ellipsis, the full text must be accessible via hover tooltip.
- Very specific: line 275
Never: use text-overflow: ellipsis without overflow: hidden and white-space: nowrap — all three are required.
- Very specific: line 282
Check first/last and partially visible items with long labels and combined hover/focus/selection states.
- Distinctive: line 283
Keep hover/focus geometry stable so controls do not jump under the pointer.
- Distinctive: line 290
Do not repair an obscured corner by clipping the entire content subtree.
- Very specific: line 294
Verify painted outlines and overlay interactions in the affected browser engines.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
This skill covers CSS file organization, naming, standard sizes, programmatic layout (SplitView, Grid, scrollable), responsive patterns, and text overflow handling.
1. File Organization
CSS files are co-located with their TypeScript components:
src/vs/base/browser/ui/button/
button.ts
button.css
src/vs/workbench/contrib/myFeature/browser/
myFeature.ts
media/
myFeature.cssImport CSS directly in the TS file:
import './media/myFeature.css';
// or for base widgets:
import './button.css';Workbench-level global styles live in src/vs/workbench/browser/media/.
2. Class Naming
monaco-prefix for all major components:.monaco-workbench,.monaco-split-view2,.monaco-scrollable-element- Modifier classes:
.monaco-split-view2.vertical,.monaco-split-view2.horizontal - State classes:
.visible,.focused,.active,.highlight - Feature-specific classes use kebab-case without prefix:
.my-feature,.outline-pane,.welcome-view-content
3. Standard Sizes
| Element | Size |
| Part title height | 35px |
| Title padding (horizontal) | 8px |
| Title label inner padding | 12px |
| Action area padding | 5px |
| Action icon size | 16px |
| Body font-size | 13px (workbench), 11px (HTML body) |
| Line height | 1.4em |
| Validation message font-size | 12px (line-height: 17px) |
For
padding/margin/gap,border-radius,font-size/font-weight, codicon size and border width, prefer the design-system size tokens over raw px — see §10 Design-System Size Tokens. Canonical reference:.github/instructions/design-tokens.instructions.md(auto-injected forsrc/vs/**/*.css).
4. CSS Selector Quality
| Anti-pattern (flagged) | Correct pattern |
ID selectors for styling (#my-widget) | Class selectors (.my-widget) |
| Overly specific selectors | Minimal specificity needed |
| Styles in the wrong file | Co-located with the component |
Missing min-width: 0 on flex children | Prevents truncation issues |
Forgetting pointer-events: none on hidden overlays | Prevents click-through bugs |
Never Add New !important
Do not introduce !important in new or modified CSS. When a declaration loses the cascade, inspect the competing selector and increase specificity with the smallest appropriate component, workbench, or state-class prefix instead. Existing !important declarations may be preserved and must not be removed mechanically during unrelated edits. Do not copy them, add new ones, or use them to avoid understanding selector ownership.
The narrow exception is shared focus/active-outline suppression, where outline: 0 !important is intentionally used to override native or global focus indicators and prevent flashing outlines during pointer activation. Keep this exception scoped to focus-indicator behavior; feature styling must still resolve cascade conflicts through selector specificity.
Represent semantic state explicitly rather than inferring it from incidental DOM order. For example, a content node ceasing to be :last-child does not prove a footer exists: completion widgets can append siblings and leave them mounted while hidden. Let the component that creates/removes the footer own its state class, and test unrelated trailing siblings.
Clipping ownership and native corners
- Assign rounded clipping to the surface that owns it. If an outer card already clips to its padding edge, a second concentric rounded clip on the content can add offscreen render surfaces on every scroll or keystroke without improving the pixels. Preserve independently positioned webview/notebook overlays that genuinely escape the card's clip; do not remove their clipping mechanically.
- For a changed rounded clip, compare the painted result and, on frequently repainted surfaces, compositor work during scroll/typing. Tests should establish the owning card's clip and effective border, not require a redundant child radius. Supply a valid border color in the test host: an invalid border shorthand can silently remove the inset being tested.
- Native-window corner geometry is not an ordinary control radius. CSS normalizes oversized radii to fit a short box, so an item can report the requested radius yet still paint the wrong native curve. Verify zoomed-out docked items as well as floating items; use an appropriately sized frame-relative paint/clipping surface when necessary.
- Test geometry invalidation on the existing instance. Custom size/radius and theme changes can update CSS without triggering layout. Observe the owning size/theme events and wait for style application instead of relying exclusively on layout callbacks or directly calling the refresh helper in tests.
5. SplitView Layout
File: src/vs/base/browser/ui/splitview/splitview.ts
For splitting views with draggable sashes (either horizontal or vertical):
const splitView = new SplitView(container, {
orientation: Orientation.VERTICAL,
proportionalLayout: true,
styles: { separatorBorder: asCssVariable(sashBorder) }
});
// Each view implements IView:
const myView: IView = {
element: myDomNode,
minimumSize: 100,
maximumSize: Number.POSITIVE_INFINITY,
onDidChange: Event.None,
layout(size, offset) { /* resize content */ }
};
splitView.addView(myView, Sizing.Distribute);Use LayoutPriority.High / .Low to control which views resize first when space is constrained. Use snap: true to allow views to snap closed.
6. Grid Layout
File: src/vs/base/browser/ui/grid/grid.ts
For 2D layouts (used by editor groups):
const grid = new Grid(initialView);
grid.addView(newView, Sizing.Distribute, referenceView, Direction.Right);7. Scrollable Content
Three classes for different needs:
| Class | When to Use |
SmoothScrollableElement | Animated scrolling (SplitView, ListView) |
DomScrollableElement | Wrap existing DOM content (hovers, menus, breadcrumbs) |
ScrollableElement | Basic single-direction scrollbar |
const scrollable = new DomScrollableElement(contentNode, {
horizontal: ScrollbarVisibility.Auto,
vertical: ScrollbarVisibility.Auto
});
this._register(scrollable);
container.appendChild(scrollable.getDomNode());
scrollable.scanDomNode(); // call after content changesKeep scroll handlers lightweight: batch layout reads before writes, coalesce duplicate measurements, and skip unchanged CSSOM writes. Cache numeric values rather than comparing rounded style strings. Validate both unchanged scrolling and resizing that changes appearance without changing the item count.
For content-sized lists and trees, distinguish logical item height from the complete scroll extent. Horizontal-scrollbar reservation can make scrollHeight larger than contentHeight; size a floating host from the extent it must actually display, with its own chrome accounted for separately. Test horizontal scrolling enabled and disabled.
Verify actual scrollbar dragging and pointer acquisition after changing margins or clipping. In maximized/fullscreen layouts, check screen-edge hit regions as well as visual placement; an inset control must not become unnecessarily difficult to acquire.
8. Responsive Layout
VS Code does not use CSS media queries. Instead, it uses a programmatic constraint-based layout system:
IView.minimumSize/maximumSize— views declare their size constraints.SplitViewandGriddistribute space according to constraints andLayoutPriority.dom.DisposableResizeObserver(not a rawResizeObserver) is used for container-aware sizing (e.g., editor auto-layout).- The window is treated as a fixed viewport; space is distributed via sash-based resizing.
When building a responsive component:
- Set
minimumSize/maximumSizeappropriately. - Use
LayoutPriority.Lowfor panels that should collapse first. - Use
snap: truefor panels that should snap closed when too small. - Fire
onDidChangewhen your constraints change dynamically.
Validate layout at the boundaries where dimensions are consumed:
- Keep grid allocation, CSS margins/borders, and child-content dimensions consistent. Exercise the real
layout()path and inspect both root bounds and dimensions passed to children; helper values and outer screenshots alone cannot prove content fits. - Read current viewport and density state during layout rather than relying solely on constructor-selected behavior. Test transitions in both directions on the same instance, including collapse/expand and narrow/wide layouts, without shifting unrelated siblings.
- Use existing screen-aware sizing helpers and the target window's effective pixel ratio for fractional scaling. Zoom alone is not device pixel ratio. Check margins, borders, and gap symmetry in CSS coordinates and physical pixels instead of adding compensating pixels or arbitrary tolerances.
- Keep startup/restored geometry aligned with runtime layout, including missing-state fallbacks. Check affected visibility, density, and window variants, and preserve intentional exclusions such as modal or auxiliary surfaces.
- Keep inter-panel spacing separate from pane-internal padding, exterior gutters, and the frame's reserved stroke. Before changing a shared margin helper, inspect all consumers. Test zero, one-pixel, odd, and maximum supported gaps; small gaps cannot fund an unconditional inset on both sides.
- Resolve configurable geometry consistently for CSS, numeric grid layout, startup paint, and auxiliary/native content. Clearing a customization must restore inheritance. Preserve resolved appearance when stale saved bounds are discarded; invalid geometry does not necessarily invalidate the user's size preferences.
- Refresh derived sash endpoints and gripper placement after grid topology changes such as moving or aligning a panel, not only after a window resize. Check odd-gap centers, newly created sashes, and removal of stale state when returning to compact or gapless layouts.
Floating and docked surfaces
- Capture the visible shared grid node's dimensions before hiding it, even when one of its logical children is already hidden. Verify resize, close/reopen, reload, and orientation changes, preserving separate width preferences where horizontal and stacked layouts intentionally differ.
- Derive detached-window frames from that window's own insets and visible layout, not mirrored main-window classes. Include main/detached combinations that disagree about visible editors or tab counts.
- Exercise hover-preview, pin/unpin, focus transfer into nested popups, deferred blur, and pointer exit through the production controller. A queued blur must not consume a newly started exit grace period. Use controlled timers to verify ordering instead of increasing delays, and restore docked sizing/padding when floating mode ends.
9. Text Overflow & Ellipsis
All text labels that can be truncated by a resizable container must use the ellipsis pattern. Clipped text without an ellipsis is a visual bug.
Standard Ellipsis Pattern (CSS)
The three-property combo is required — all three must be present:
.my-label {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}Common Locations That Need Ellipsis
| Element | Why |
Part title labels (h2, breadcrumbs) | Sidebar/panel can be resized narrower than the title |
| View pane header titles | View containers can be narrow |
| List/tree row labels | Rows have a fixed width from the list container |
| Tab labels (editor tabs) | Many tabs shrink to fit |
| Button labels in welcome views | Buttons have max-width constraints |
| Status bar items | Many items compete for horizontal space |
| Notification message text | Notification toast/center has fixed width |
| Tooltip/hover headings | Hovers have max-width |
| Dropdown/select items | Select boxes have bounded width |
| Badge text / descriptions | Auxiliary text in constrained columns |
Flex Container Gotchas
Flex children default to min-width: auto, which prevents text-overflow: ellipsis from working because the flex item refuses to shrink below its content width. Fix this by setting min-width: 0 on the flex child:
/* WRONG — ellipsis will NOT trigger inside a flex container */
.flex-parent {
display: flex;
}
.flex-parent > .label {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* CORRECT — add min-width: 0 so the flex item can shrink */
.flex-parent > .label {
min-width: 0; /* ← this is the fix */
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}This pattern is used throughout VS Code — for example, .monaco-icon-label-container sets min-width: 0 and flex: 1 to allow label text to truncate.
Fixed vs Flexible Elements
When a row has both fixed-size elements (icons, action buttons) and flexible text:
.row {
display: flex;
align-items: center;
}
.row > .icon {
flex-shrink: 0; /* icon never shrinks */
width: 16px;
}
.row > .label {
flex: 1; /* label takes remaining space */
min-width: 0; /* allows shrinking below content width */
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.row > .actions {
flex-shrink: 0; /* action buttons never shrink */
}This is the standard pattern for tree rows, list items, tab labels, and view pane headers.
Hover for Full Text
When text is truncated with ellipsis, the full text must be accessible via hover tooltip. Use IHoverService.setupDelayedHover() with the full untruncated text so users can read it:
this._register(this.hoverService.setupDelayedHover(labelElement, {
content: fullLabelText,
}));For IconLabel and list/tree renderers, this is handled automatically. For custom DOM, you must add it manually.
Anti-Patterns (NEVER DO)
- Never let single-line text labels clip without an ellipsis. This rule applies to labels, not structural clipping containers or overflow masks.
- Never rely on a fixed pixel width for text that could be localized — localized strings vary in length.
- Never use
text-overflow: ellipsiswithoutoverflow: hiddenandwhite-space: nowrap— all three are required. - Never forget
min-width: 0on flex children that need to truncate. - Never truncate text without providing a hover/tooltip for the full string.
Clipping and Alignment
- Measure content items separately from adjacent actions and toolbars. Recalculate clipping when labels, status indicators, or actions change width, even if the viewport is unchanged.
- Check first/last and partially visible items with long labels and combined hover/focus/selection states. Masks must not cover actions or scroll hit targets. Recreated overflow edges must preserve the source edge's shape and border state, and clear stale state when clipping ends.
- Keep hover/focus geometry stable so controls do not jump under the pointer. Test state transitions on existing elements as well as fresh renders.
- Define which semantic value should align in compound badges or labels. Centering a variable-width string does not preserve the alignment of its trailing status; compare short and long compound values alongside single-value rows.
Rounded-surface geometry
- Trace the painted perimeter through the production ancestors before changing a radius or overflow rule. Identify the owner of the frame stroke, content paint, material layer, connected cap, and overlays. A child can report the correct radius while an ancestor clips its outline or content paints over it.
- Match the reference boxes as well as the radius. A pseudo-element positioned inside a host border does not share the host's outer curve merely because it inherits
border-radius. Use the appropriate border/padding-box geometry; for unequal or elliptical corners and fractional border widths, prefer browser-resolved curves over a uniform subtraction. - Do not repair an obscured corner by clipping the entire content subtree. Progress indicators and fixed completion widgets may intentionally escape it, and transforms or filters can change fixed-position containing blocks. Isolate decorative paint from interactive content and preserve overlay stacking and hit targets.
- Repainting an edge must not create a second, inset frame or double-paint a translucent stroke. Align the replacement paint to the original frame and verify the composited result at all exposed corners, including square corners. A computed radius or an overlay hit test alone cannot prove the perimeter is correct.
- Derive connected caps, clipping fallbacks, and nested frames from the owning surface's semantic radius and effective inset, not a generic default. Honor square/custom radii, asymmetric Activity Bar seams, footer presence, and native window overrides. Check both header and footer ancestors when the Activity Bar can move.
- At adjoining surfaces, assign each visible edge one owner in every relevant density/theme. If a compact card omits its trailing frame, the adjacent column may need to paint the separator; adding borders to both creates a doubled edge. Verify full-height coverage and that unaffected default/HC layouts do not gain an extra stroke.
- Verify painted outlines and overlay interactions in the affected browser engines. Include short/narrow panes, retained hidden overlay siblings, footer add/remove, fractional scaling, and the relevant maximized/fullscreen/native-window states. Keep native-platform evidence distinct from a web-only reproduction.
10. Design-System Size Tokens (spacing, radius, font, codicon, stroke)
VS Code ships a design-system size ramp, registered in src/vs/platform/theme/common/sizes/baseSizes.ts and emitted as --vscode-* CSS variables. When writing or editing CSS, prefer the token var over a raw px value wherever a token exists. The full tables + rationale live in the auto-injected .github/instructions/design-tokens.instructions.md (canonical source — keep this section in sync with it). This section captures the decision logic for deeper styling tasks.
Every
var()you reference, except product-icon--vscode-icon-*-contentand--vscode-icon-*-font-familyvariables, must exist inbuild/lib/stylelint/vscode-known-variables.jsonor stylelint/hygiene fails. After registering a new token inbaseSizes.ts, run./scripts/test-documentation.shto regenerate the"sizes"array; CSS-only custom properties belong in"others".
Spacing — padding, margin, gap
Scale (px): 0, 2, 4, 6, 8, 10, 12, 16, 20, 24, 28, 32, 36, 40 → --vscode-spacing-sizeNone, --vscode-spacing-size20 … --vscode-spacing-size400 (token number = px × 10, so size200 = 20px).
What matters is the value, not the token. Adopting the var() is optional — a raw px value is fine as long as it lands on the scale. What breaks rhythm is an off-scale value (3, 5, 7, 14, 26px…). Snap off-scale values to the nearest scale value, ties round up (5px → 6px, 3px → 4px, 1px → 2px, 26px → 28px). Each length of a shorthand is checked independently (0 5px → 0 6px). Leave auto, %, em/rem, var()/calc() untouched.
Corner radius — border-radius
| px | Variable | Use |
| 2 | --vscode-cornerRadius-xSmall | very compact elements |
| 4 | --vscode-cornerRadius-small | controls (buttons, inputs) |
| 6 | --vscode-cornerRadius-medium | base / inner surfaces |
| 8 | --vscode-cornerRadius-large | prominent / outer surfaces |
| 12 | --vscode-cornerRadius-xLarge | very prominent surfaces |
| 9999 | --vscode-cornerRadius-circle | fully rounded (pills, dots) |
Snap map for off-scale literals (ties round up): 2→xSmall, 3,4→small, 5,6→medium, 7,8→large, 10,11,12→xLarge, 14,16,18,20→xLarge, 999→circle.
- Pills (radius ≈ half the element height — e.g.
28h/14r,36h/18r,22×22/11r) →--vscode-cornerRadius-circle, not xLarge. The literal-nearest token would square them and lose the fully-rounded intent. - Leave untouched:
50%,0,0px,inherit, anycalc()/var(). Preserve!important.
The ramp describes generic design defaults, not a replacement for component-specific geometry. When a panel exposes a semantic size customization, its frame and dependent paint must consume that resolved value, including 0, rather than snapping it back to a generic radius. Keep native-window radii and control/overlay tiers separate from panel preferences.
At supported standalone or fixture boundaries where size tokens may be absent, provide valid length fallbacks for required padding, insets, radii, and outlines. A var() fallback handles an unavailable custom property, not a defined value of the wrong type or a unitless length. Follow the existing host contract rather than adding speculative fallbacks to every token.
Font size & weight
Generic UI ramp — pair a size token with a weight token ("Strong" = matching size token + semiBold, never a separate size):
| px | Size var | Weight |
| 26 | --vscode-fontSize-heading1 | semiBold |
| 18 | --vscode-fontSize-heading2 | semiBold |
| 13 | --vscode-fontSize-heading3 | semiBold |
| 13 | --vscode-fontSize-body1 | regular |
| 11 | --vscode-fontSize-body2 | regular |
| 12 | --vscode-fontSize-label1 | regular |
| 11 | --vscode-fontSize-label2 | regular |
| 10 | --vscode-fontSize-label3 | regular |
Generic weights: --vscode-fontWeight-regular (400), --vscode-fontWeight-semiBold (600).
Deprecated — --vscode-bodyFontSize (13) → --vscode-fontSize-body1, --vscode-bodyFontSize-small (12) → --vscode-fontSize-label1, --vscode-bodyFontSize-xSmall (11) → --vscode-fontSize-body2.
The legacy Agents-specific --vscode-agents-fontSize-* and --vscode-agents-fontWeight-* tokens are also deprecated; use the matching generic tokens.
- No medium (500).
font-weight: 500is off the ramp — snap tosemiBold. Likewise700/bold→ round to the nearer of 400/600. - "Strong" is not a separate size. "Body 1 Strong" = the matching
--vscode-fontSize-*size token +semiBold. Never add a strong size. normal≡ 400 →regular. Leaveinherit,lighter,bolder,var()/calc()untouched.
Codicon size — icon font-size
Codicons are only ever 16px or 12px — never 14px or any in-between value.
| px | Variable | Use |
| 16 | --vscode-codiconFontSize (base) | default icon size |
| 12 | --vscode-codiconFontSize-compact | dense/inline chrome |
Compact-glyph convention: when sizing an icon at the compact 12px size, also use its registered *Compact variant when available (e.g. Codicon.close → Codicon.closeCompact). CSS font-size alone scales the regular glyph; it does not select the optically tuned variant. Inspect aliases before declaring a variant missing: pencil can use the existing edit-compact glyph through the canonical edit icon. Use the owning layer's existing resolver, such as getCompactCodicon in Chat, preserving color/modifiers and falling back to the original icon when no variant is registered. Do not invent a -compact ID or introduce a cross-layer import to reuse a feature-specific helper.
Audit selectors and tests keyed on the original glyph class when swapping it; update them or use a glyph-independent wrapper. Also verify streaming updates, late tool metadata, restored history, and composite renderers, not only initial standalone rendering. A dependency bump and passing leaf-component tests do not prove every surface uses the new glyph.
Stroke — border width
A single stroke thickness: 1px → --vscode-strokeThickness. Applies to the border: 1px solid <color> shorthand and border-width: 1px. Other widths have no token — leave them.
/* prefer */ border: var(--vscode-strokeThickness) solid var(--vscode-widget-border);
/* avoid */ border: 1px solid var(--vscode-widget-border);Key Files
| Area | File |
| SplitView | src/vs/base/browser/ui/splitview/splitview.ts |
| Grid | src/vs/base/browser/ui/grid/grid.ts |
| Scrollbar | src/vs/base/browser/ui/scrollbar/scrollableElement.ts |
| Global workbench styles | src/vs/workbench/browser/media/style.css |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

