feathericons / react-feather

React component for Feather icons
https://npm.im/react-feather
MIT License
1.93k stars 126 forks source link

change icon dynmically from database #96

Open abdotigami opened 2 years ago

abdotigami commented 2 years ago

Icon.{variable} can i do this

xavimb commented 2 years ago

I guess if you use the original feather icons library you can replace the href parameter in the SVG to point to the icon you want:

<svg class="feather">
  <use href={`path/to/dist/feather-sprite.svg#{variable}`}/>
</svg>
akulsr0 commented 2 years ago

@abdotigami Incase you want something like following:

Preview: https://fzqqlu.csb.app/ Sandbox Link: https://codesandbox.io/s/smoosh-https-fzqqlu