Integrate with React
Install and use Univer Icons in React projects.
Add icons to a React interface, then adjust their size and colors to match the surrounding controls.
Install the package
Install the icon package in a React project:
pnpm add @univerjs/iconsnpm install @univerjs/iconsyarn add @univerjs/iconsbun add @univerjs/iconsAdd an icon to a button
Select a component in the icon preview and import it by name. The copy button below keeps a text label next to its icon.
import { CopyIcon } from '@univerjs/icons'export function CopyButton({ onCopy }: { onCopy: () => void }) { return ( <button type="button" onClick={onCopy}> <CopyIcon aria-hidden="true" /> <span>Copy</span> </button> )}The copy handler is passed through onCopy. The icon is decorative because the visible text already names the action.
Set size and color
An icon inherits its color from the surrounding text and its size from 1em. Set fontSize and color on the icon to override either value:
import { AddImageIcon } from '@univerjs/icons'export function ImageToolIcon() { return ( <AddImageIcon aria-hidden="true" style={{ fontSize: 20, color: '#27272a' }} /> )}Set both colors of a two-color icon
A two-color icon uses color for its main color and extend.colorChannel1 for its accent. The example below pairs dark gray with a light gray accent:
import { PaintBucketDoubleIcon } from '@univerjs/icons'export function FillToolIcon() { return ( <PaintBucketDoubleIcon aria-hidden="true" style={{ fontSize: 20, color: '#27272a' }} extend={{ colorChannel1: '#d4d4d8' }} /> )}Multicolor icons, including brand logos, may come with fixed colors. These settings do not replace every color in such icons.
Keep strokes thin when enlarging icons
If an enlarged icon appears too heavy, use preserveStrokeWidth. Strokes that support it keep the width they have at 16 × 16, and filled shapes are unaffected. Check the result with the stroke control in the preview before applying it.
import { ShapePieIcon } from '@univerjs/icons'export function ShapeToolIcon() { return ( <ShapePieIcon aria-hidden="true" preserveStrokeWidth style={{ fontSize: 48 }} /> )}Give icon-only buttons a name
When a button has no visible text, add aria-label="Copy" to the button and keep aria-hidden="true" on the icon so that screen readers can announce the action.
To have an AI Agent find the icon and write the integration code, connect MCP.
How is this guide?