simple-vue-icon
TypeScript icon, indicating that this package has built-in type declarations

1.3.5 • Public • Published

simple-vue-icon

npm version

A simple icon component for Vue 3.

Installation

npm add simple-vue-icon

Usage

Import from vue-simple-icon to use the icon in your Vue components:

<script>
import { mdiArrowLeft } from '@mdi/js';
import VueIcon from 'simple-vue-icon';

export default {
  components: { VueIcon },
  setup() {
    return {
      mdiArrowLeft,
    };
  },
};
</script>

<template>
  <vue-icon :icon="mdiArrowLeft" />
</template>

or using <script setup> (recommended):

<script setup>
import { mdiArrowLeft } from '@mdi/js';
import VueIcon from 'simple-vue-icon';
</script>

<template>
  <vue-icon :icon="mdiArrowLeft" />
</template>

If you don't want to import the component manually, you can register it globally in your app's entrypoint:

import { createApp } from 'vue';
import App from './app.vue';
import VueIcon from 'simple-vue-icon';

const app = createApp(App);
app.use('VueIcon', VueIcon);
// ...

Props

icon (required)

The path string of the icon to render.

width/height (number or string; default: 24)

<vue-icon :icon="mdiArrowLeft" width="30" :height="30" />

size (number or string; default: 24)

Sets the width and the height of the icon

<!-- Equivalent to <vue-icon :icon="mdiArrowLeft" width="64" height="64" /> -->
<vue-icon :icon="mdiArrowLeft" size="64" />

Credits

Most of the code is forked from mdi-vue.

Package Sidebar

Install

npm i simple-vue-icon

Weekly Downloads

2

Version

1.3.5

License

MIT

Unpacked Size

14.3 kB

Total Files

11

Last publish

Collaborators

  • leondreamed