Use Phosphor Icons in Vue
masterInstall @phosphor-icons/vue to use Phosphor icons as Vue components.
Key Features:
- Naming Convention: To avoid namespace collisions with built-in HTML elements, component names are prefixed with
Ph(e.g.,PhHorse). - Styling: Customize
color,size, andweightvia props. - Global Styles: Use the
provide/injectAPI to provide default styles to all icons. - Tree-shaking: Fully tree-shakable.
- Template Usage: You can use both PascalCase and kebab-case in your templates.
Available weights for the weight prop: thin, light, regular, bold, fill, and duotone (standardized via props).
<template>
<div>
<PhHorse />
<PhHeart :size="32" color="hotpink" weight="fill" />
<PhCube />
</div>
</template>
<script>
import { PhHorse, PhHeart, PhCube } from "@phosphor-icons/vue";
export default {
name: "App",
components: {
PhHorse,
PhHeart,
PhCube,
},
};
</script>