microsoft/vscode/ux-css-layout
Claude Code and agent skill by microsoft/vscode
- vendor
Checking that the SKILL.md file is still in the repository.
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.
Install
npx vskill@latest install microsoft/vscode/ux-css-layoutSKILL.md
The same SKILL.md was published earlier as microsoft/vscode/ux-css-layout.
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:
Import CSS directly in the TS file:
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) |
Forpadding/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):
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):
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 |
Keep 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:
Common Locations That Need Ellipsis
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files. Certified 7 Sep 2026.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryChecking.github/skills/ux-css-layout/SKILL.md
Popularity
- Repository stars
- 191,449
- Repository forks
- 42,039
- 7-day trend score
- 61
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/microsoft/vscode/ux-css-layout)