Prerequisites
Before you begin, make sure you have:- Visual Studio Code version 1.109.0 or higher installed
- View Exports SVG extension installed (see Installation)
- A JavaScript or TypeScript project with SVG components exported from
.js,.jsx,.ts, or.tsxfiles
View Exports SVG works with JavaScript and TypeScript files that export SVG components. The extension automatically detects exported SVG elements from React, Preact, and similar frameworks.
Open your first SVG icons
There are three ways to launch the View Exports SVG viewer. Choose the method that works best for your workflow.Method 1: Scan entire workspace
The fastest way to discover all SVG icons in your project is to scan your entire workspace.Open the Command Palette
Press
Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (macOS) to open the Command Palette.Run the scanning command
Type
View Exports SVG: Start Scanning and press Enter.The extension will scan all JavaScript and TypeScript files in your workspace to find exported SVG components.Method 2: Use the context menu
You can also launch the viewer from a specific file or folder using the context menu.Locate your icon files
In the VS Code Explorer, navigate to a JavaScript or TypeScript file containing SVG exports.The file must have a
.js, .jsx, .ts, or .tsx extension (excluding .d.ts files).Right-click the file
Right-click on the file in the Explorer or in the editor.You can also select multiple files or an entire folder.
Method 3: Drag and drop files
Once the viewer is open, you can add more icons by dragging and dropping files.Explore the interface
Once the View Exports SVG panel opens, you’ll see an interactive interface with several key areas:Icon grid
The main area displays all discovered SVG components in a grid layout.Each icon shows a preview of the SVG along with its component name.
Search and filter
Use the search box at the top to filter icons by name.Type at least 3 characters to start searching.
Recent and favorites
View your recently used icons and favorites in dedicated sections.Mark icons as favorites by clicking the star icon for quick access later.
Interact with your icons
Now that you can see your icons, here’s what you can do with them:Copy component name
Copy to clipboard
The component name is automatically copied to your clipboard.You’ll see a confirmation notification.
Use the interactive playground
The DevTools panel includes an interactive playground where you can experiment with icon properties.Open DevTools
Click any icon to select it, which automatically opens the DevTools panel.Alternatively, click the tools icon in the title bar.
Edit properties
In the code editor within DevTools, modify properties like
size, color, fill, stroke, width, and height.The preview updates in real-time as you type.Export icons
You can export icons in multiple formats for use outside of VS Code.Choose export format
In the DevTools panel, find the export options.You can export as SVG or PNG format.
Available commands
View Exports SVG provides several commands accessible from the Command Palette (Ctrl+Shift+P or Cmd+Shift+P):
- View Exports SVG: Start Scanning - Scan workspace for all SVG components
- View Exports SVG: Reload Theme - Reload the viewer theme to match your current VS Code theme
- View Exports SVG: Clear Cache - Clear the cached icon data (useful if icons aren’t updating)
- Expand All / Collapse All - Expand or collapse all icon groups
- Open DevTools / Close DevTools - Toggle the DevTools panel
- Clear Cache - Clear cached data
Configure default settings
You can customize View Exports SVG behavior in VS Code settings.Customize settings
Key settings you can configure:
- Default Expand All: Expand all icon groups by default
- Default Click To Open DevTools: Automatically open DevTools when clicking an icon
- Assets Path: Specify custom directories to scan for icons
- Ignore Directories: Exclude specific directories from scanning
- Default Icon Properties: Set default values for icon properties in the playground
Changes to settings like Assets Path or Ignore Directories require rescanning your workspace to take effect.
Troubleshooting
No SVG components found
No SVG components found
If the extension doesn’t find any icons:
- Ensure your files have
.js,.jsx,.ts, or.tsxextensions - Verify that your components export SVG elements (not just import them)
- Check that the files aren’t in ignored directories
- Try clearing the cache with View Exports SVG: Clear Cache and rescanning
Icons not updating after code changes
Icons not updating after code changes
The extension caches scanned icons for performance. If you modify an icon component:
- Run View Exports SVG: Clear Cache from the Command Palette
- Rescan your workspace with View Exports SVG: Start Scanning
DevTools not opening
DevTools not opening
If clicking an icon doesn’t open DevTools:
- Check the Default Click To Open DevTools setting
- Manually open DevTools by clicking the tools icon in the title bar
- Ensure the View Exports SVG panel is active
Icons appear empty or broken
Icons appear empty or broken
If icons display incorrectly:
- Verify the SVG component exports valid JSX/TSX
- Check for syntax errors in your icon files
- Ensure all required props have default values or are optional
- Try reloading the theme with View Exports SVG: Reload Theme
Next steps
Congratulations! You’ve successfully viewed your first SVG icons with View Exports SVG. Here are some next steps:Configuration
Learn about advanced configuration options and customization
Features
Explore all features including grouping patterns, recent icons, and more
Tips & Tricks
Discover productivity tips and advanced workflows
Troubleshooting
Get help with common issues and error messages