Iconsax Icon Pack for Vue

2.0.0 · active · verified Sun Apr 19

vue-iconsax is a JavaScript package providing a comprehensive set of Iconsax icons specifically designed for Vue 3 applications. It is currently at version 2.0.0 and focuses on delivering 6000 icons across 6 distinct design styles (Linear, Outline, TwoTone, Bulk, Broken, Bold), all meticulously crafted on a 24px grid. The library emphasizes lightweight usage and ease of integration, differentiating itself by exclusively supporting Vue 3 and offering dynamic icon loading through a single `VsxIcon` component. This approach streamlines icon usage by eliminating the need for individual icon imports, enabling developers to render any available icon simply by passing its PascalCase name as a prop. The package's release cadence appears tied to updates from the core Iconsax library and Vue 3 ecosystem developments.

Common errors

Warnings

Install

Imports

Quickstart

This example demonstrates how to globally register the `VsxIcon` component in `main.js` and then dynamically change the displayed icon in an `App.vue` component using Vue 3's Composition API.

import { createApp, ref } from 'vue';
import App from './App.vue';
import { VsxIcon } from 'vue-iconsax';

// main.js - Global registration of VsxIcon component
const app = createApp(App);
app.component('VsxIcon', VsxIcon);
app.mount('#app');

// App.vue - Example usage in a Vue component
export default {
  name: 'App',
  setup() {
    const iconNames = ['Activity', 'Archive1', 'Bookmark', 'Chart', 'Cloud'];
    let currentIndex = ref(0);
    const currentIcon = ref(iconNames[currentIndex.value]);

    const cycleIcon = () => {
      currentIndex.value = (currentIndex.value + 1) % iconNames.length;
      currentIcon.value = iconNames[currentIndex.value];
    };

    return {
      currentIcon,
      cycleIcon
    };
  },
  template: `
    <div id="app" style="font-family: Avenir, Helvetica, Arial, sans-serif; text-align: center; color: #2c3e50; margin-top: 60px; display: flex; flex-direction: column; align-items: center; gap: 20px;">
      <h1>Dynamic Iconsax Demo</h1>
      <VsxIcon :iconName="currentIcon" color="#4a90e2" size="64" type="twotone" />
      <p>Current Icon: <strong>{{ currentIcon }}</strong></p>
      <button @click="cycleIcon" style="padding: 10px 20px; font-size: 1em; cursor: pointer; border: 1px solid #4a90e2; background-color: #4a90e2; color: white; border-radius: 5px;">Next Icon</button>
    </div>
  `
};

view raw JSON →