登录 注册
其他 inline-svgloaderreactreact-nativereact-svgreact-svg-creator
11,061
Stars
441
Forks
32
Watchers
153
Open Issues
MIT
许可证
TypeScript
语言
2017-09-01
创建时间
2026-03-01
最近更新

项目能做什么

可将 SVG 矢量图直接转换为 React 组件的代码转换工具。
来源:基于仓库元数据 · 内容以仓库实际 README 为准

使用说明 查看原始 README 原仓库文档

中文使用说明暂未生成。下面保留原仓库 README 摘录,命令与配置均以原文为准。
原始 README 摘录(英文原文,节选前 3000 字符)
<h1 align="center">
  <img src="https://raw.githubusercontent.com/gregberge/svgr/master/resources/svgr-logo.png" alt="svgr" title="svgr" width="300">
</h1>
<p align="center" style="font-size: 1.2rem;">Transform SVGs into React components 🦁</p>

[![License](https://img.shields.io/npm/l/@svgr/core.svg)](https://github.com/gregberge/svgr/blob/master/LICENSE)
[![Donate](https://opencollective.com/svgr/backers/badge.svg)](https://opencollective.com/svgr/donate)
[![npm package](https://img.shields.io/npm/v/@svgr/core/latest.svg)](https://www.npmjs.com/package/@svgr/core)
[![npm downloads](https://img.shields.io/npm/dm/@svgr/core.svg)](https://www.npmjs.com/package/@svgr/core)
[![CI](https://github.com/gregberge/svgr/actions/workflows/ci.yml/badge.svg)](https://github.com/gregberge/svgr/actions/workflows/ci.yml)
[![Code Coverage](https://img.shields.io/codecov/c/github/gregberge/svgr.svg)](https://codecov.io/github/gregberge/svgr)

[**Try it out online!**](https://react-svgr.com/playground)

[**Watch the talk at React Europe**](https://www.youtube.com/watch?v=geKCzi7ZPkA)

SVGR is an universal tool to transform SVG into React components.

SVGR takes a raw SVG and transforms it into a ready-to-use React component.

## [Docs](https://react-svgr.com)

**See the documentation at [react-svgr.com](https://react-svgr.com)** for more information about using `svgr`!

Quicklinks to some of the most-visited pages:

- [**Playground**](https://react-svgr.com/playground/)
- [**Getting started**](https://react-svgr.com/docs/getting-started/)
- [CLI usage](https://react-svgr.com/docs/cli/)
- [Webpack usage](https://react-svgr.com/docs/webpack/)
- [Node.js usage](https://react-svgr.com/docs/node-api/)

## Example

**Take a SVG**:

```html
<?xml version="1.0" encoding="UTF-8"?>
<svg
  width="48px"
  height="1px"
  viewBox="0 0 48 1"
  version="1.1"
  xmlns="http://www.w3.org/2000/svg"
  xmlns:xlink="http://www.w3.org/1999/xlink"
>
  <!-- Generator: Sketch 46.2 (44496) - http://www.bohemiancoding.com/sketch -->
  <title>Rectangle 5</title>
  <desc>Created with Sketch.</desc>
  <defs></defs>
  <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
    <g
      id="19-Separator"
      transform="translate(-129.000000, -156.000000)"
      fill="#063855"
    >
      <g id="Controls/Settings" transform="translate(80.000000, 0.000000)">
        <g id="Content" transform="translate(0.000000, 64.000000)">
          <g id="Group" transform="translate(24.000000, 56.000000)">
            <g id="Group-2">
              <rect id="Rectangle-5" x="25" y="36" width="48" height="1"></rect>
            </g>
          </g>
        </g>
      </g>
    </g>
  </g>
</svg>
```

**Run SVGR**

```sh
npx @svgr/cli --icon --replace-attr-values "#063855=currentColor" -- icon.svg
```

**Get an optimized React component**

```js
import * as React from 'react'

const SvgComponent = (props) => (
  <svg width="1em" height="1em" viewBox="0 0 48 1" {...props}>
    <path d="M0 0h48v1
阅读完整原文

项目深度分析 规则生成(AI 未配置)

综合评分 61.4 分。该项目在“个人可实施性”维度得 57 分,“付费可能性”维度得 60.0 分,差异化空间 100.0 分(评分依据见评分卡)。

将 svgr 改造为垂直场景 SaaS

产品构想保留核心能力,针对某一类用户(如某行业团队)做托管版,收取月费。
目标用户有该需求的中小团队 / 独立站长
难度/周期中 · 2~4 周(MVP)
收费模式订阅制(如 ¥29~99/月)
竞争风险需验证付费意愿;注意许可证合规
依据 数据支持的判断:许可证与关键词显示存在商用与付费场景

面向细分需求的二次开发产品

产品构想基于 svgr 的核心能力,聚焦一个更窄的场景(如某平台、某行业)做差异化。
目标用户该细分场景用户
难度/周期中 · 2~6 周
收费模式买断制 / 订阅制 / 广告
竞争风险细分需求规模需验证
依据 AI 推测:基于项目主题标签的判断

封装为在线小工具或 API 服务

产品构想把项目最常用的一个功能做成网页小工具,靠流量变现或按量计费。
目标用户搜索引擎带来的长尾用户
难度/周期低 · 1~3 周
收费模式免费引流 + 增值功能 / API 按量计费
竞争风险同质化竞争,需做好 SEO
依据 AI 推测:基于技术栈与部署特征的判断
以上为规则引擎基于仓库公开数据生成的参考结论,包含推测成分,不构成投资或创业承诺;配置 AI 后可获得更深入的分析。
报告会保存到 个人中心

竞品与相似项目 GitHub Search 真实检索

项目中文简介Stars语言
rossmoody/svg-gobbler 中文介绍暂未生成
Open source browser extension for finding, editing, exportin
1,054 TypeScript
iconic/SVGInjector 中文介绍暂未生成
Fast, caching, dynamic inline SVG DOM injection library
972 JavaScript
iconfu/svg-inject 中文介绍暂未生成
A tiny, intuitive, robust, caching solution for injecting S
837 TypeScript
jamesmartin/inline_svg 中文介绍暂未生成
Embed SVG documents in your Rails views and style them with
772 Ruby
以上为通过 GitHub 官方 Search API 检索的相似项目,功能差异与优劣势需进一步人工确认,配置 AI 后可生成对比分析。

项目优势与风险

技术成熟度创建于 2017-09-01,最近推送 2026-03-01,发布过 69 个 Release
社区活跃Star 11,061 / Fork 441 / Issue 153(数据支持,可自行核实)
许可证MIT
主要风险上游项目方向可能变化;同赛道竞争者较多(见竞品表);热度与需求不完全等价

安装与使用

此项目未提供 Docker 镜像,安装步骤以原仓库 README 为准(涉及依赖安装与环境配置,对新手门槛较高)。