# Iconography URL: /lynx/foundation/iconography Source: https://github.com/daangn/seed-design/blob/dev/docs/content/lynx/foundation/iconography.mdx Explains how to use the Lynx icon package. ## Installation Monochrome - npm: npm install @karrotmarket/lynx-monochrome-icon - pnpm: pnpm add @karrotmarket/lynx-monochrome-icon - yarn: yarn add @karrotmarket/lynx-monochrome-icon - bun: bun add @karrotmarket/lynx-monochrome-icon Multicolor - npm: npm install @karrotmarket/lynx-multicolor-icon - pnpm: pnpm add @karrotmarket/lynx-multicolor-icon - yarn: yarn add @karrotmarket/lynx-multicolor-icon - bun: bun add @karrotmarket/lynx-multicolor-icon ## Rsbuild Plugin Configuration You need to configure an Rsbuild plugin that converts Lynx icon SVGs to WebP data URLs. The `@karrotmarket/lynx-*-icon` package internally uses SVG assets from the `karrotmarket/assets-*` package. The plugin below converts the package asset to a WebP data URL module using `sharp` during build so it can be reliably displayed in Lynx. - npm: npm install -D @seed-design/rsbuild-plugin-lynx-icon - pnpm: pnpm add -D @seed-design/rsbuild-plugin-lynx-icon - yarn: yarn add --dev @seed-design/rsbuild-plugin-lynx-icon - bun: bun add --dev @seed-design/rsbuild-plugin-lynx-icon ```ts title="lynx.config.ts" import { defineConfig } from "@lynx-js/rspeedy"; import { pluginQRCode } from "@lynx-js/qrcode-rsbuild-plugin"; import { pluginReactLynx } from "@lynx-js/react-rsbuild-plugin"; import { pluginLynxIcon } from "@seed-design/rsbuild-plugin-lynx-icon"; import { pluginTypeCheck } from "@rsbuild/plugin-type-check"; export default defineConfig({ plugins: [ pluginQRCode({ schema(url) { // We use `?fullscreen=true` to open the page in LynxExplorer in full screen mode return `${url}?fullscreen=true`; }, }), pluginReactLynx(), pluginTypeCheck(), pluginLynxIcon({ include: /node_modules\/@karrotmarket\/assets-(monochrome|multicolor)\/svg\//, }), ], }); ``` ## Icon Library You can view the complete icon list on the [Icon Library](/foundations/iconography/library) page. ## Usage After installing the icon package and configuring the loader, you can use icons in your project. ```tsx import { IconArrow2ClockwiseCircularFill, IconArrow2ClockwiseCircularLine, } from "@karrotmarket/lynx-monochrome-icon"; import { IconCamera } from "@karrotmarket/lynx-multicolor-icon"; export function App() { return ( Monochrome icons require the color prop. Multicolor icons do not have a color prop. ); } ``` ## Crispy Component Slots When rendering only icons directly on a regular screen, use the `@karrotmarket/lynx-*-icon` component as shown in the example above. When using monochrome icon slots in Crispy components, use the `Icon`, `PrefixIcon`, and `SuffixIcon` wrappers from `@seed-design/lynx-react`. The wrapper synchronizes the color calculated from the recipe className to Lynx `` `tint-color` and passes the slot size to the icon image. When specifying color, pass it only to the wrapper's `color` prop. Do not specify `color` or `tint-color` on the icon component passed to `icon`. ```tsx import IconChevronDownFill from "@karrotmarket/lynx-monochrome-icon/IconChevronDownFill"; import IconPlusFill from "@karrotmarket/lynx-monochrome-icon/IconPlusFill"; import { ActionButton, Icon, PrefixIcon, SuffixIcon } from "@seed-design/lynx-react"; export function App() { return ( } /> Add } /> } /> ); } ```