Mochi Icons
DOCS · 02 / 07

React usage

Import an icon, place it in your JSX and set its size.

Import it, then use it

Every icon is a React component. Import the one you want and put it in your JSX.

EXAMPLE
import { ShoppingCartIcon } from "mochi-icons/ShoppingCartIcon";

export function CartLink() {
  return <ShoppingCartIcon />;
}

Find the right name

The component name is the object's name with each word capitalised, plus Icon at the end.

OBJECTCOMPONENT
cameraCameraIcon
shopping-cartShoppingCartIcon
alarm-clockAlarmClockIcon

The easiest way is to open the library, click an icon and copy the import from there.

Set the size

Icons are 24 pixels by default. Use the size prop to change that. It sets both the width and the height.

SIZES
<BellIcon size={16} />
<BellIcon size={24} />
<BellIcon size={32} />
<BellIcon size={48} />

You can also pass a CSS value as a string, like size="1.5em", so the icon grows with the text around it.

Use it inside a button

Take photo
BUTTON
<button type="button" className="flex items-center gap-2">
  <CameraIcon size={20} />
  Take photo
</button>

All props

PROPDEFAULTWHAT IT DOES
size24Width and height. A number (pixels) or any CSS size.
colorcurrentColorColour of monochrome icons. Stickers keep their own colours.
primaryColorOriginal paletteSelected Sticker or Pixels accent, with tonal variations. Accepts hex or CSS colors.
strokeWidth2Line thickness of monochrome icons.
classNameNoneCSS classes for the <svg> element.
refNoneGives you the <svg> element.

Any other prop you can give an <svg> also works, for example style, onClick or data-* attributes.

A LITTLE SUPPORT GOES A LONG WAY

Love the icons?

Your contribution helps keep the icons free, pay for infrastructure, and bring more features to life.

Every contribution is optional. The icons stay free for everyone.

Choose your amount at checkout. One-time contribution.