You can import an icon from its own file, or from the main package.
DIRECT IMPORT (RECOMMENDED)
import { CameraIcon } from "mochi-icons/CameraIcon";
MAIN PACKAGE
import { CameraIcon, BellIcon } from "mochi-icons";
Both give you the same icon. A direct import loads only that one file, so it is always the smallest. It also keeps your dev server fast, because it doesn't load the whole set.
How the path works
The path is the package name, a slash, and the component name. The name is the same in the path and in the curly braces.
ICON
IMPORT
camera
import { CameraIcon } from "mochi-icons/CameraIcon";
shopping-cart
import { ShoppingCartIcon } from "mochi-icons/ShoppingCartIcon";
volume-up
import { VolumeUpIcon } from "mochi-icons/VolumeUpIcon";
Other entry points
PATH
WHAT'S IN IT
mochi-icons
Every icon, plus the IconProps type.
mochi-icons/<Name>Icon
One icon.
mochi-icons/metadata
The list of all icons (names, files, kinds). Only load this if you build an icon picker.
"Cannot find module" error
If TypeScript can't find a direct import, check these in order:
Spelling and capitals.CameraIcon works, cameraIcon does not.
Your TypeScript settings. In tsconfig.json, set moduleResolution to "bundler" (or "node16"). The old "node" setting can't see per-icon paths.