Language: JavaScript
Icons
Phosphor was created to provide developers with a modern, lightweight, and highly adaptable icon library. It emphasizes scalability, accessibility, and design consistency, making it easy to integrate into various UI frameworks.
Phosphor is a flexible and versatile icon library for web and mobile projects. It offers a wide range of customizable icons in multiple weights, styles, and formats, suitable for React, Vue, or plain HTML usage.
npm install phosphor-iconsyarn add phosphor-icons<script src='https://unpkg.com/phosphor-icons'></script>Download individual icons or the entire package and include them in your project.Phosphor icons can be used as React/Vue components or as plain SVG elements. You can customize size, weight, color, and other properties either via props or CSS.
import { Heart } from 'phosphor-react';
function App() {
return <Heart size={32} color='red' weight='fill' />;
}Renders a filled heart icon in React with a size of 32 pixels and red color.
<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32' fill='currentColor' viewBox='0 0 256 256'>
<path d='M128 232s-90-48-90-136c0-55 45-100 100-100s100 45 100 100c0 88-90 136-90 136z'/>
</svg>Uses a Phosphor icon as an inline SVG element that can be styled with CSS.
<Heart size={32} weight='thin' />
<Heart size={32} weight='light' />
<Heart size={32} weight='bold' />Demonstrates different icon weights (thin, light, bold) for design flexibility.
<Heart size={32} color='gray' className='hover:text-red-500 transition-colors' />Applies Tailwind CSS classes for hover color change and smooth transitions.
<div className='relative'>
<Star size={32} color='yellow' />
<Star size={16} color='white' className='absolute top-0 left-0' />
</div>Combines multiple Phosphor icons in a stacked layout for complex UI designs.
Import only the icons you need to minimize bundle size.
Use consistent weight and size across your UI for visual harmony.
Combine with CSS or Tailwind utilities for interactive effects.
Prefer React/Vue components for easier integration and props control.
Leverage inline SVGs for advanced styling or animation needs.