# @svgr/core

> Transform SVG into React Components.

Latest version **8.1.0** (published 2023-08-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install @svgr/core
pnpm add @svgr/core
yarn add @svgr/core
bun add @svgr/core
```

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; popular repo.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 8.1.0 |
| Published | 2023-08-15 |
| First published | 2018-06-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=14 |
| Dependencies | 5 |
| Unpacked size | 24.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 11061 |
| Author | Greg Bergé |
| Maintainers | neoziro |
| Keywords | svgr, svg, react, core, api |

## Links

- npm: https://www.npmjs.com/package/@svgr/core
- Repository: https://github.com/gregberge/svgr.git#main
- Homepage: https://react-svgr.com
- Issues: https://github.com/gregberge/svgr/issues
- Funding: https://github.com/sponsors/gregberge
- npm.io page: https://npm.io/package/@svgr/core

## Dependencies (5)

- [camelcase](https://npm.io/package/camelcase.md) ^6.2.0
- [snake-case](https://npm.io/package/snake-case.md) ^3.0.4
- [@babel/core](https://npm.io/package/@babel/core.md) ^7.21.3
- [cosmiconfig](https://npm.io/package/cosmiconfig.md) ^8.1.3
- [@svgr/babel-preset](https://npm.io/package/@svgr/babel-preset.md) 8.1.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 8.1.0 (latest) — 2023-08-15
- 6.0.0-alpha.4 (next) — 2021-11-13
- 2.0.0-alpha.26fa501a (canary) — 2018-06-12
- 8.0.0 — 2023-05-09
- 7.0.0 — 2023-03-24
- 6.5.1 — 2022-10-27
- 6.5.0 — 2022-10-14
- 6.4.0 — 2022-10-01
- 6.3.1 — 2022-07-22
- 6.3.0 — 2022-07-18
- 6.2.1 — 2022-01-30
- 6.2.0 — 2022-01-10
- 6.1.2 — 2021-12-12
- 6.1.1 — 2021-12-04
- 6.1.0 — 2021-12-01
- … 30 more at https://npm.io/package/@svgr/core/versions

## README

# @svgr/core

[![Build Status][build-badge]][build]
[![version][version-badge]][package]
[![MIT License][license-badge]][license]

Node API of SVGR.

```
npm install @svgr/core
```

## Usage

```js
import { transform } 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>
`

transform(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 any plugin, if you want them, you have to install them and include them in config.

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

## License

MIT

[build-badge]: https://img.shields.io/travis/smooth-code/svgr.svg?style=flat-square
[build]: https://travis-ci.org/smooth-code/svgr
[version-badge]: https://img.shields.io/npm/v/@svgr/core.svg?style=flat-square
[package]: https://www.npmjs.com/package/@svgr/core
[license-badge]: https://img.shields.io/npm/l/@svgr/core.svg?style=flat-square
[license]: https://github.com/smooth-code/svgr/blob/master/LICENSE

---
_Source: https://npm.io/package/@svgr/core · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
