@svgr/core (5.5.0)

Published 2026-02-24 13:51:18 +00:00 by atheaadmin

Installation

@svgr:registry=
npm install @svgr/core@5.5.0
"@svgr/core": "5.5.0"

About this package

@svgr/core

Build Status version MIT License

Node API of SVGR.

npm install @svgr/core

Usage

import svgr from '@svgr/core'

const svgCode = `
<svg xmlns="http://www.w3.org/2000/svg"
  xmlns:xlink="http://www.w3.org/1999/xlink">
  <rect x="10" y="10" height="100" width="100"
    style="stroke:#ff0000; fill: #0000ff"/>
</svg>
`

svgr(svgCode, { icon: true }, { componentName: 'MyComponent' }).then(
  (jsCode) => {
    console.log(jsCode)
  },
)

Use svgr.sync(code, config, state) if you would like to use sync version.

Plugins

By default @svgr/core doesn't include svgo and prettier plugins, if you want them, you have to install them and include them in config.

svgr(svgCode, {
  plugins: ['@svgr/plugin-svgo', '@svgr/plugin-jsx', '@svgr/plugin-prettier'],
}).then((jsCode) => {
  console.log(jsCode)
})

License

MIT


Dependencies

Dependencies

ID Version
@svgr/plugin-jsx ^5.5.0
camelcase ^6.2.0
cosmiconfig ^7.0.0

Keywords

svgr svg react core api
Details
npm
2026-02-24 13:51:18 +00:00
1
Greg Bergé
MIT
latest
6.1 KiB
Assets (1)
core-5.5.0.tgz 6.1 KiB
Versions (1) View all
5.5.0 2026-02-24