Preview panel controls
Zoom controls
Control the zoom level of your SVG preview using these methods:| Action | Control | Behavior |
|---|---|---|
| Zoom in | Click on SVG | Increases zoom by 50% (up to 1000%) |
| Zoom out | Alt + Click on SVG | Decreases zoom by 20% (down to 10%) |
| Zoom in (scroll) | Alt + Scroll up | Increases zoom by 10% increments |
| Zoom out (scroll) | Alt + Scroll down | Decreases zoom by 10% increments |
| Reset zoom | Click center icon | Resets to 100% zoom and centers SVG |
Pan controls
When zoomed in beyond 100%, you can pan around the SVG:| Action | Control | Requirement |
|---|---|---|
| Pan | Click + Drag | Zoom must be > 100% |
| Stop panning | Release mouse | - |
- Default: Zoom in cursor
- Alt pressed: Zoom out cursor
- Panning: Grabbing hand cursor
Toolbar controls
The preview panel includes these toolbar buttons:| Icon | Function | Description |
|---|---|---|
| Color swatch | Change currentColor | Click to open color picker |
| Moon/Sun | Toggle background | Switch between light and dark background |
| Center icon | Reset view | Reset zoom to 100% and center SVG |
| Lightning bolt | Optimize | Run SVGO optimization on the file |
Hover preview controls
When hovering over inline SVGs in your code:Enable/disable hover preview
Control hover preview in your settings:Hover interaction
View preview
A popup appears showing:
- Visual preview of the SVG
- File size in bytes or KB
- Link to optimize the SVG
Gutter preview
SVG icons appear in the editor gutter (next to line numbers) for inline SVGs:Enable/disable gutter preview
- Shows a small (16px) preview of each SVG
- Appears at the start of each
<svg>tag - Updates automatically as you edit
- Respects your current VS Code theme (dark/light)
Keyboard state tracking
Better SVG carefully tracks the Alt key state to provide smooth zoom control:- Cursor changes immediately when Alt is pressed
- Alt state is cleared when the window loses focus
- Works on both Windows/Linux (Alt) and macOS (Option)