Pictogrammers / pictogrammers.com

Code for Pictogrammers.com
https://pictogrammers.com
74 stars 16 forks source link

Official Web Component Support #78

Closed jameslovallo closed 1 year ago

jameslovallo commented 1 year ago

Describe your suggested feature

It would be great to have an official MDI Web Component implementation that fetches an icon by name and allows it to be styled. Custom elements are framework agnostic, all one would need to do to use the icons is import the element and set the name property. I'd be happy to polish this up and open a PR if there's any interest.

CodePen Example

Features

Example Implementation

<script src=//unpkg.com/@mdi/element type="module"></script>

<mdi-icon icon="account" style="color: blue; width: 2rem;"></mdi-icon>

<mdi-icon icon="dog" style="color: brown; width: 2rem;"></mdi-icon>

<mdi-icon icon="cat" style="color: magenta; width: 2rem;"></mdi-icon>

<mdi-icon icon="car" style="color: red; width: 2rem;"></mdi-icon>

<mdi-icon icon="layers" style="color: green; width: 2rem;"></mdi-icon>
mririgoyen commented 1 year ago

Our Web Component solution is documented here: https://pictogrammers.com/docs/library/mdi/getting-started/webcomponent/

It's published under the namespace of one of our core contributors, but we have plans to move it under the @pictogrammers namespace in the future.