Language: JavaScript
Icons
Heroicons was created by the makers of Tailwind CSS to provide a cohesive and visually appealing set of icons that integrate seamlessly with Tailwind-based projects. It focuses on simplicity, scalability, and clarity, making it popular among frontend developers.
Heroicons is a set of free, MIT-licensed high-quality SVG icons for UI development. It provides both outline and solid styles, optimized for modern web applications.
npm install @heroicons/reactyarn add @heroicons/react<script src='https://unpkg.com/@heroicons/react/outline/index.js'></script>Download SVG icons directly from the Heroicons website and include them in your project.Heroicons can be used as React components, Vue components, or inline SVGs. They are customizable via size, color, stroke, and other SVG attributes.
import { AcademicCapIcon } from '@heroicons/react/outline';
function App() {
return <AcademicCapIcon className='h-6 w-6 text-blue-500' />;
}Imports the `AcademicCapIcon` from Heroicons and renders it with a specific size and color in a React component.
import { AcademicCapIcon } from '@heroicons/react/solid';
function App() {
return <AcademicCapIcon className='h-6 w-6 text-green-500' />;
}Uses the solid variant of the icon with a custom color.
<AcademicCapIcon className='h-12 w-12 text-red-600' />Adjusts the height, width, and color of the icon using Tailwind CSS classes.
<AcademicCapIcon className='h-6 w-6 text-blue-500 animate-spin' />Applies a spin animation to the icon using Tailwind CSS animation classes.
<svg xmlns='http://www.w3.org/2000/svg' class='h-6 w-6' fill='none' viewBox='0 0 24 24' stroke='currentColor'>
<path stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 14l9-5-9-5-9 5 9 5z' />
</svg>Uses Heroicons as an inline SVG element with customizable attributes.
Import only the icons you need to reduce bundle size.
Use Tailwind CSS classes for consistent sizing and coloring.
Prefer React/Vue components for ease of integration and maintainability.
Use solid or outline variants consistently to match your UI design.
Combine with accessibility attributes like `aria-label` or `title` for screen readers.