simple-vue-icon

A simple icon component for Vue 3
1,792
Install
npm install simple-vue-icon
Latest Version:1.3.5
Vue:3
License:MIT
Last Updated:May 16, 2022
Links: GitHub  ·  npm
Maintainer: leonsilicon

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>
  <VueIcon :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.

Related Packages

vue-material-design-icons

A collection of material design icons as Vue single file components

3,140,911 171
vue-material-design-icons-size

A collection of material design icons as Vue single file components

35,593
paw-vue-icons

A collection of material design icons as Vue single file components

16,984 171
vue3-material-design-icons-ts

A collection of material design icons as Vue single file components

1,062 2

Version History

Version Released Vue License
1.3.5 ^3 MIT
1.3.4 ^3 MIT
1.3.3 ^3 MIT
1.3.2 ^3 MIT
1.3.1 ^3 MIT