React
@coolicons/react has one component per icon, with an entry for every style and corner radius.
Install
npm install @coolicons/reactRequires React 18 or later.
Use
Import icons by name. Only the icons you import end up in your bundle.
import { House, Folder } from "@coolicons/react";
export function Toolbar() {
return (
<nav>
<House size={20} />
<Folder strokeWidth={1.5} title="Projects" />
</nav>
);
}Styles and corners
The package root is Line with Regular corners. Every other combination has its own entry, with the same component names in each.
| Import from | Gives you |
|---|---|
@coolicons/react | Line, Regular corners |
@coolicons/react/fill | Fill, Regular corners |
@coolicons/react/bulk/round | Bulk, Round corners |
@coolicons/react/<style>/<radius> | Any combination |
import { House } from "@coolicons/react";
import { Folder } from "@coolicons/react/fill";
import { Bell } from "@coolicons/react/bulk/round";Styles are line, duocolor, duotone, fill and bulk. Corners are sharp, regular and round.
Props
| Prop | Default | What it does |
|---|---|---|
size | 24 | Width and height. A number is pixels, a string can be any CSS length, like 1.25rem or 1em. |
strokeWidth | 2 | Stroke width of Line, Duocolor and Duotone. Fill and Bulk have no strokes and ignore it. |
title | none | Adds a <title> and role="img". Without a title the icon gets aria-hidden="true". |
All other props go to the svg element: className, style, aria-*, event handlers and a ref to the svg.
<House
size="1.25rem"
strokeWidth={1.5}
className="nav-icon"
title="Home"
/>Names
Components use the icon name in PascalCase: file-plus-corner becomes FilePlusCorner. Every component is also exported with an Icon suffix, like FilePlusCornerIcon. Both names always work.
Use the plain name unless JavaScript, the browser or a framework already uses it. Map is a JavaScript global, File a browser global and Link a component in Next.js and React Router. Importing an icon with such a name hides the original in that file, so value instanceof File quietly stops working. For these icons, use the suffix.
import Link from "next/link";
import { LinkIcon } from "@coolicons/react";| Component | Taken in |
|---|---|
ActivityIcon | React |
BluetoothIcon | Browser |
ClipboardIcon | Browser, React Native |
CodeIcon | Astro |
ComponentIcon | React, Preact, Angular |
FileIcon | Browser, Node, Deno, Bun, React Native |
FontIcon | Astro |
FunctionIcon | JavaScript |
GamepadIcon | Browser |
HistoryIcon | Browser |
ImageIcon | Browser, Next.js, React Native, Astro |
InfinityIcon | JavaScript |
KeyboardIcon | Browser, React Native |
LabelIcon | Expo Router |
LinkIcon | Next.js, React Router, TanStack Router, Expo Router, Qwik, Inertia, Gatsby |
LockIcon | Browser, Deno |
MapIcon | JavaScript |
NavigationIcon | Browser |
OptionIcon | Browser |
PresentationIcon | Browser |
RouteIcon | React Router, TanStack Router, Solid |
RouterIcon | React Router, TanStack Router, Solid, Angular |
SettingsIcon | React Native |
ShareIcon | React Native |
TextIcon | Browser, React Native, Vue |
WindowIcon | Browser, Deno |
TypeScript
Types ship with the package. Every entry exports IconProps, IconComponent, IconVariant and IconRadius.
import type { IconComponent } from "@coolicons/react";
type NavItem = { label: string; icon: IconComponent };To render an icon from a string, use CooliconsIcon.