A react SVG component for rendering SVG icons in a circle
You have an SVG icon that you want to put centered within a circle. Maybe you want the circle to have an outline or be completely filled in, or both.
This is a component that renders SVG icons centered within a larger circular SVG with ability to set an outline and/or fill on the circular SVG.
This module is distributed via npm which is bundled with node and
should be installed as one of your project's dependencies
:
npm install circular-icon-wrapper --save
This package also depends on
react
andprop-types
. Please make sure you have those installed as well.
import CircularIconWrapper from 'circular-icon-wrapper';
<CircularIconWrapper stroke="#27ae60" strokeWidth={50} size="10em">
<svg viewBox="0 0 1000 1000" fill="#27ae60">
<path d="M68 500.5c0-14.7 5-27.3 15-38l76-76c10.7-10.7 23.3…" />
</svg>
</CircularIconWrapper>
node
Sets children to render within circular icon wrapper
string
| defaults totransparent
Sets circular icon wrapper fill color
string
| defaults totransparent
Sets circular icon wrapper stroke color
number
| defaults to 0
Sets circular icon wrapper stroke width. Note that this sets width in SVG that is being scaled. Value set for this will not be rendered at 1:1 ratio.
string
| defaults to1em
Sets height and width of circular icon wrapper SVG to same value. (px, em, percentage).
https://bjankord.github.io/circular-icon-wrapper/
MIT