Styling
Change size, colour and stroke with props, CSS or Tailwind.
Two kinds of icons
Mochi Icons come in two kinds. How you colour an icon depends on its kind.
| KIND | COLOURS | CAN YOU RECOLOUR IT? |
|---|---|---|
| Multicolour | Original palette with a selectable accent | Yes, with primaryColor on supported Sticker and Pixels icons. |
| Monochrome | One colour | Yes, with color or CSS. |
Sticker and Pixels are icon families. Multicolour icons preserve their original palette unless you select a theme accent.
Size
Use the size prop, or set the width and height with CSS. CSS wins over the prop.
<WifiIcon size={32} />
{/* Tailwind */}
<WifiIcon className="size-12" />
{/* Plain CSS */}
<WifiIcon style={{ width: 48, height: 48 }} />Primary colour (Sticker and Pixels)
Match your theme with primaryColor. Each icon has a selected accent area: Houseplant changes its leaves and keeps its terracotta pot; Camera changes its body and keeps its blue lens. Omit the prop to keep the original palette.
Pixels supports the same prop, for example <CameraPixelIcon primaryColor="#8B5CF6" />. FigmaPixel, RainbowPixel and PoolBallPixel preserve their original palettes.
<HouseplantIcon />
<HouseplantIcon primaryColor="#8B5CF6" />
<HouseplantIcon primaryColor="#26B" />
<HouseplantIcon primaryColor="var(--primary)" />
<HouseplantIcon primaryColor="currentColor" />Three- and six-digit hex colors produce standalone SVG paints. CSS variables and named colors use color-mix() for tonal variations, which requires browser support. Google, Instagram and Rainbow keep their defining multicolor palettes. Try the color controls in the library drawer; copied JSX and SVG downloads match your selection.
Colour (monochrome icons)
A monochrome icon uses the text colour around it. So if the text is red, the icon is red too. You can also set it yourself.
{/* Follows the text colour of its parent */}
<p style={{ color: "tomato" }}>
<SomeIcon /> Saved
</p>
{/* Set it directly */}
<SomeIcon color="#2C3E5C" />
{/* Tailwind */}
<SomeIcon className="text-emerald-600" />To make the lines thinner or thicker, use strokeWidth. The default is 2.
<SomeIcon strokeWidth={1.5} />Line up an icon with text
Put the icon and the text in a flex row. This keeps them centred on the same line.
<span style={{ display: "inline-flex", alignItems: "center", gap: 8 }}>
<CheckIcon size={22} />
All done
</span>Want the icon to scale with the font size? Use size="1em".
Hover and animation
Icons are plain <svg> elements, so normal CSS works: transitions, transforms and hover states.
import { BellIcon } from "mochi-icons/BellIcon";
<BellIcon className="transition-transform hover:rotate-12" />