Phosphor Icons for Vue

1.4.2 · active · verified Sun Apr 19

Phosphor-vue provides a comprehensive set of highly customizable SVG icons specifically tailored for Vue.js applications. The library is currently stable at version `2.2.0` for Vue 3 projects, offering a wide range of icons with multiple display weights (thin, light, regular, bold, fill, duotone). For Vue 2 users, version `1.x` branches are maintained separately. Releases typically align with updates to the core Phosphor Icons library, introducing new icons and bug fixes. Key differentiators include robust TypeScript support, a focus on flexibility through various icon weights for dynamic styling and state representation, and support for both global and individual component registration to balance convenience with bundle size optimization. It integrates seamlessly into Vue's component system, accepting standard SVG attributes and custom props for styling.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates global installation of PhosphorVue as a plugin for a Vue 3 application, allowing any icon to be used directly in templates without individual imports.

import { createApp } from 'vue';
import PhosphorVue from 'phosphor-vue';
import App from './App.vue';

const app = createApp(App);

// Register PhosphorVue as a global plugin
app.use(PhosphorVue);

app.mount('#app');

// App.vue example
/*
<template>
  <div>
    <h1>My App</h1>
    <ph-heart :size="32" color="red" weight="fill" />
    <ph-cube :size="24" color="blue" />
    <ph-star :weight="isStarred ? 'fill' : 'regular'" @click="toggleStar" />
  </div>
</template>

<script setup>
import { ref } from 'vue';
const isStarred = ref(false);
const toggleStar = () => { isStarred.value = !isStarred.value; };
</script>
*/

view raw JSON →