Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vite-plugin-svgr

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-svgr

Vite plugin to transform SVGs into React components

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.3M
decreased by-1.23%
Maintainers
1
Weekly downloads
 
Created

What is vite-plugin-svgr?

The vite-plugin-svgr package allows you to import SVG files as React components in your Vite projects. This enables you to easily manipulate and use SVG images within your React applications, offering a streamlined workflow for working with SVGs.

What are vite-plugin-svgr's main functionalities?

Import SVG as a React Component

This feature allows you to import an SVG file directly as a React component, which you can then use in your JSX just like any other component. This simplifies the process of using SVGs in your application, making them more flexible and easier to style or manipulate.

import { ReactComponent as Logo } from './logo.svg';

function App() {
  return (
    <div>
      <Logo />
    </div>
  );
}

Customize SVGs with SVGR Options

This feature leverages SVGR options to customize SVGs when they are imported as React components. You can pass props to the SVG component to dynamically change its properties, such as the title, fill color, and more. This adds a layer of flexibility in how SVGs are rendered and used within your application.

import { ReactComponent as Logo } from './logo.svg?svgr';

function App() {
  return (
    <div>
      <Logo title="Logo Title" />
    </div>
  );
}

Other packages similar to vite-plugin-svgr

Keywords

FAQs

Package last updated on 09 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc