Overview Version History Q & A Rating & Review
IMI SVG to React Icon Extension
VS Code extension that converts SVG files to React components using @imile/components SvgIcon.
Features
Convert SVG files to React components with a single command
Automatic viewBox extraction from SVG content
PascalCase component naming (e.g., upload-fill.svg
→ UploadFillIcon
)
Integration with @imile/components SvgIcon component
Usage
Convert SVG File to React Component
Right-click on an SVG file in the explorer
Select "Convert SVG to React Component"
The React component will be created in the same directory
The generated file will automatically open in the editor
Alternative: Use Keyboard Shortcut
Open an SVG file in the editor
Press Ctrl+Shift+I
(or Cmd+Shift+I
on Mac)
The current SVG file will be converted automatically
import { SvgIcon } from '@imile/components';
import type { SvgIconProps } from '@imile/components';
export function ComponentNameIcon(props: SvgIconProps) {
return (
<SvgIcon viewBox="0 0 width height" {...props}>
{/* SVG content */}
</SvgIcon>
);
}
Development
Install dependencies: npm install
Compile TypeScript: npm run compile
Press F5 to run the extension in a new Extension Development Host window
Test the extension with SVG files
Requirements
VS Code 1.74.0 or higher
@imile/components package in your project