Greg Bergé 21d52adb3d wip
2021-09-19 11:06:24 +02:00
2021-09-05 23:09:18 +02:00
2021-09-05 10:38:22 +02:00
2021-09-05 09:26:47 +02:00
2021-03-05 09:27:15 +01:00
wip
2021-09-19 11:06:24 +02:00
2021-09-16 23:40:28 +02:00
2021-09-17 00:34:42 +02:00
wip
2021-09-19 11:06:24 +02:00
2018-11-22 16:28:34 +01:00
2021-01-26 08:33:13 +01:00
2017-09-02 10:11:13 +00:00
2021-09-05 09:26:47 +02:00
2018-06-12 10:54:35 +00:00
2020-11-15 11:22:58 +01:00
2021-09-05 09:27:36 +02:00
2018-11-24 16:01:28 +01:00
2020-11-15 11:22:58 +01:00
2017-12-20 17:25:53 +01:00
wip
2021-09-19 11:06:24 +02:00
2021-01-26 08:33:13 +01:00
wip
2021-09-19 11:06:24 +02:00

svgr

Transform SVGs into React components 🦁

License Donate npm package npm downloads Build Status Code Coverage Code style Dependencies DevDependencies Gitpod Ready-to-Code

Try it out online!

Watch the talk at React Europe

SVGR transforms SVG into ready to use components. It is part of create-react-app and makes SVG integration into your React projects easy.

Docs

See the documentation at react-svgr.com for more information about using svgr!

Quicklinks to some of the most-visited pages:

Example

Take an icon.svg:

<?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

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

Output

import * as React from 'react'

const SvgComponent = (props) => (
  <svg width="1em" height="1em" viewBox="0 0 48 1" {...props}>
    <path d="M0 0h48v1H0z" fill="currentColor" fillRule="evenodd" />
  </svg>
)

export default SvgComponent

Supporting SVGR

SVGR is a MIT-licensed open source project. It's an independent project with ongoing development made possible thanks to the support of these awesome backers. If you'd like to join them, please consider:

Gold Sponsors

Gold Sponsors are those who have pledged $100/month and more to SVGR.

gold-sponsors

Contributing

Check out the contributing guidelines

License

Licensed under the MIT License, Copyright © 2017-present Smooth Code.

See LICENSE for more information.

Acknowledgements

This project has been popularized by Christopher Chedeau and it has been included in [create-react-app] thanks to Dan Abramov. We would like to thanks Sven Sauleau for his help and its intuition.

Description
No description provided
Readme MIT 14 MiB
Languages
TypeScript 65.5%
MDX 19.4%
JavaScript 14.7%
Shell 0.4%