# svg-inline-react **Repository Path**: mirrors_stevemao/svg-inline-react ## Basic Information - **Project Name**: svg-inline-react - **Description**: Inline svg wrapper component for React - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-09-26 - **Last Updated**: 2025-10-05 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # `svg-inline-react`: Inline SVG wrapper component for React This component wraps `dangerouslyInnerHTML` prop for easier use. Inlining SVG has pros and cons; See ["Using SVG"](https://css-tricks.com/using-svg/) for further detail. However, I recommended to use static svg transformed as React component, since React now supports svg properly. ## note for 1.x.x user: transpiling is discontinued I removed `dist` and `es` and made `lib` (which is ES2015 source) default, and there are several reason for it. For now use of ES2015 (and modules) is widespread, there are many tools supporting it (i.e. Webpack 2, Rollup), and you will use them anyway – if you are using React/etc. If you want to stay in CommonJS land, please specify deps as `1.x.x`. i.e) `svg-inline-react: 1.x.x` ## Usage You can use [`svg-inline-loader`](https://github.com/sairion/svg-inline-loader) with [Webpack](https://webpack.github.io) to inline SVG. Example: ```jsx import InlineSVG from 'svg-inline-react'; // Use with loader // Use without loader const svgSource = ` `; ``` ### prop `src` : string valid SVG element string. ### prop `element` : string You can change element where svg included using `element` prop, default is ``. But self closed tags like `img` is not allowed, and an error will be thrown from React side. ### prop `raw` : bool (experimental!) This prop allows your svg file to be rendered directly, without a container element wraps it. This is an experimental feature. Also, the prop will be ignored on server side rendering environment. ## Notes [inspired by](https://gist.github.com/MoOx/1eb30eac43b2114de73a)