Beautiful hand-crafted SVG icons as React components, providing outline and solid icon variants in multiple sizes for modern React applications.
npx @tessl/cli install tessl/npm-heroicons--react@2.2.0Heroicons React is a comprehensive React component library providing beautiful hand-crafted SVG icons created by the makers of Tailwind CSS. It offers 325 unique icons in both outline and solid variants for 24px and 20px sizes, plus 317 icons at 16px size, with each icon exported as an individual React component using TypeScript for full type safety.
npm install @heroicons/reactHeroicons React uses size-specific import paths only. Direct imports from the root package are intentionally blocked to encourage optimal bundle sizes.
// 24px outline icons (most common)
import { AcademicCapIcon, ArrowDownIcon } from "@heroicons/react/24/outline";
// 24px solid icons
import { AcademicCapIcon, ArrowDownIcon } from "@heroicons/react/24/solid";
// 20px solid icons (compact interfaces)
import { AcademicCapIcon, ArrowDownIcon } from "@heroicons/react/20/solid";
// 16px solid icons (smallest size, limited set)
import { AcademicCapIcon, ArrowDownIcon } from "@heroicons/react/16/solid";For CommonJS:
const { AcademicCapIcon, ArrowDownIcon } = require("@heroicons/react/24/outline");
const { AcademicCapIcon, ArrowDownIcon } = require("@heroicons/react/24/solid");
const { AcademicCapIcon, ArrowDownIcon } = require("@heroicons/react/20/solid");
const { AcademicCapIcon, ArrowDownIcon } = require("@heroicons/react/16/solid");import React from 'react';
import { HeartIcon, UserIcon } from '@heroicons/react/24/outline';
import { CheckCircleIcon } from '@heroicons/react/24/solid';
function MyComponent() {
return (
<div>
{/* Basic usage with default styling */}
<HeartIcon className="h-6 w-6 text-red-500" />
{/* Icons accept all standard SVG props */}
<UserIcon
className="h-8 w-8 text-blue-600"
onClick={() => console.log('clicked')}
aria-label="User profile"
/>
{/* With custom title for accessibility */}
<CheckCircleIcon
className="h-5 w-5 text-green-500"
title="Task completed"
titleId="task-completed-icon"
/>
</div>
);
}Heroicons React is built around several key design principles:
All icon names follow the pattern:
{IconName}Iconacademic-cap.svgAcademicCapIconarrow-down-tray.svgArrowDownTrayIconchat-bubble-left-right.svgChatBubbleLeftRightIconThe most comprehensive icon set with 325 outline-style icons optimized for 24px rendering. Perfect for primary interfaces, navigation, and general UI elements.
// All 325 icons available as named exports
import {
AcademicCapIcon,
ArrowDownIcon,
HeartIcon,
UserIcon,
// ... 321 more icons
} from "@heroicons/react/24/outline";
// Each icon component interface
type OutlineIconComponent = React.ForwardRefExoticComponent<
React.PropsWithoutRef<React.SVGProps<SVGSVGElement>> &
{ title?: string; titleId?: string } &
React.RefAttributes<SVGSVGElement>
>;Matching solid variants for all 325 icons, providing filled versions perfect for active states, selected items, and emphasis.
// All 325 solid icons available as named exports
import {
AcademicCapIcon,
ArrowDownIcon,
HeartIcon,
UserIcon,
// ... 321 more icons
} from "@heroicons/react/24/solid";
// Each icon component interface (same as outline)
type SolidIconComponent = React.ForwardRefExoticComponent<
React.PropsWithoutRef<React.SVGProps<SVGSVGElement>> &
{ title?: string; titleId?: string } &
React.RefAttributes<SVGSVGElement>
>;Compact 325-icon set optimized for smaller interface elements like buttons, form controls, and dense layouts.
// All 325 icons at 20px size
import {
AcademicCapIcon,
ArrowDownIcon,
HeartIcon,
UserIcon,
// ... 321 more icons
} from "@heroicons/react/20/solid";
// Same component interface as other sizes
type Icon20Component = React.ForwardRefExoticComponent<
React.PropsWithoutRef<React.SVGProps<SVGSVGElement>> &
{ title?: string; titleId?: string } &
React.RefAttributes<SVGSVGElement>
>;Smallest icon set with 317 icons optimized for minimal interface elements, badges, and tight spacing requirements.
// 317 icons available at 16px size (8 fewer than other sizes)
import {
AcademicCapIcon,
ArrowDownIcon,
HeartIcon,
UserIcon,
// ... 313 more icons
} from "@heroicons/react/16/solid";
// Same component interface as other sizes
type Icon16Component = React.ForwardRefExoticComponent<
React.PropsWithoutRef<React.SVGProps<SVGSVGElement>> &
{ title?: string; titleId?: string } &
React.RefAttributes<SVGSVGElement>
>;// Standard React SVG props that all icons accept
interface IconProps extends React.SVGProps<SVGSVGElement> {
/** Optional accessible title for the icon */
title?: string;
/** Optional ID for the title element */
titleId?: string;
/** CSS class names for styling */
className?: string;
/** Click handler */
onClick?: (event: React.MouseEvent<SVGSVGElement>) => void;
/** Custom styles */
style?: React.CSSProperties;
/** ARIA label for accessibility */
'aria-label'?: string;
/** ARIA described by */
'aria-describedby'?: string;
}
// Default SVG attributes applied to all icons
interface DefaultAttributes {
xmlns: "http://www.w3.org/2000/svg";
fill: "none"; // outline icons, "currentColor" for solid icons
viewBox: string; // "0 0 24 24", "0 0 20 20", or "0 0 16 16"
strokeWidth?: 1.5; // outline icons only
stroke?: "currentColor"; // outline icons only
'aria-hidden': "true";
'data-slot': "icon";
}The package includes helpful error handling for common import mistakes:
@heroicons/react@heroicons/react/outline@heroicons/react/solid"sideEffects": false