0.4.1 • Published 4 years ago

mdi-component v0.4.1

Weekly downloads
6
License
ISC
Repository
gitlab
Last release
4 years ago

Web Component for Material Design Icons

This is a package that implements material design icons in es6 web components.

npm i mdi-component @mdi/js

Attributes

AttributeDefaultDetails
pathrequired if is nullSVG path data. Usually from @mdi/js
sizeinherited40px, 1.3rem...
horizontalinexistantFlip horizontal
verticalinexistantFlip vertical
rotate0Degrees 0 to 360
colorinheritedrgb() / rgba() / #000
spininexistantSpin animation

Usage

In order to use the attribute path, the component must be used in an ES6 module. Eg: HTML

<body>
  <main-page></main-page>
  <script src="./main.js" type="module"></script>
</body>

JS (main.js)

import { mdiAccount } from "/node_modules/@mdi/js/mdi.js";
import "/node_modules/mdi-component/mdi-component.js";

class MainPage extends HTMLElement {

  constructor() {
    super();
    this.shadow = this.attachShadow({ mode: 'open' });
  }

  connectedCallback() {
    this.shadow.innerHTML = "";
    const templateEl = document.createElement("template");
    templateEl.innerHTML = this.template;
    this.shadow.appendChild(templateEl.content.cloneNode(true));
  }

  get template() {
    return `
      <mdi-component 
        path="${mdiAccount}"
        size="36px"
        horizontal
        vertical
        rotate="45"
        color="blue"
        >
      </mdi-component>
    `;
  }

}

customElements.define("main-page", MainPage);
0.4.1

4 years ago

0.4.0

4 years ago

0.3.0

4 years ago

0.2.2

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago