Guides · docs/guides/using-icons.md
Using the icons
Everything in build/ is committed, so you can use the icons without building. Pick the format that fits where the icon goes.
| Path | What | Use it for |
|---|---|---|
build/svg/<style>/<name>.svg |
outlined, currentColor |
web <img> or inline, native asset catalogs, font tools |
build/svg-live/<style>/<name>.svg |
live strokes, editable | Figma and Sketch editing. Knockout gaps are not applied here; production uses the outlined file |
build/sprite/cardsite-icons-<style>.svg |
<symbol id="cs-<name>"> |
server-rendered HTML |
build/js/cardsite-icons.{mjs,cjs,umd.js} + .d.ts |
all paths and an svg() helper |
plain JS, server rendering |
build/js/icons/<name>.mjs |
one icon per module | bundles that tree-shake |
build/react/CsIcon.tsx |
<CsIcon>, <CsTile> |
React |
build/tokens/tokens.{css,json} |
sizes, weights, colour roles (hex and OKLCH) | theming |
build/manifest.json |
every icon, tag, alias and minSize; brand index; legacy map |
pickers, search, migration |
build/brand/** |
tiles, mark, file types, badges, logos, illustrations | product and marketing |
build/png/** |
brand tiles at 64 and 256, logos at 32, 180 and 512 | app stores, email, slides |
Which size and style to use, and how to colour them: usage.
React
import "@csxbase/cardsite-icons/tokens/tokens.css"; // once, at the app root
import { CsIcon } from "@csxbase/cardsite-icons/react";
<CsIcon name="link" /> // 20 px Regular, decorative
<CsIcon name="trash" size={16} variant="bold" title="Delete" />
<a aria-current="page"><CsIcon name="home" variant="duotone" className="cs-tone-accent" /> Home</a>
name also accepts v6 names (account → user) and warns in development. An unknown name is a type error. Products, tools and pillars are tiles, not glyphs: <CsTile kind="products" name="sites" label="Sites" />.
Plain JS
import { svg } from "@csxbase/cardsite-icons";
button.innerHTML = svg("share", { size: 20 }) + "<span>Share</span>";
el.innerHTML = svg("check-circle", { style: "duotone", title: "Published" });
For the smallest bundles, import single icons: import home from "@csxbase/cardsite-icons/icons/home.mjs". home.regular[0] is the path.
Sprite
<!-- inline build/sprite/cardsite-icons-regular.svg once, near <body> -->
<svg class="cs-icon" width="20" height="20" aria-hidden="true"><use href="#cs-link"/></svg>
Use one sprite per style on a page; ids are the same in every sprite.
Design tools
Drag build/svg/<style>/ into Figma (outlined, recommended) or build/svg-live/<style>/ (editable strokes). Name components icon/<category>/<name> with a style property (light | regular | bold | duotone) and set the fill to a colour variable. Don't detach and redraw: change the source and rebuild (adding an icon).
Native
- iOS: add
build/svg/<style>/*.svgto an asset catalog as single-scale vectors with Preserve Vector Data, rendered as Template Image. Light, Regular and Bold map to SF Symbols-style weights; in Duotone the plate is the secondary layer; Fill maps to the.fillvariant. - Android: import with Android Studio's Vector Asset tool; tint with
?attr/colorOnSurface. - Email: use
build/png/, or inline the outlined SVG with a fixed fill. Many email clients ignorecurrentColor.
From the command line or an agent
node tools/cli.mjs svg link --style bold prints an icon. The MCP server gives an agent search and SVG access: agents.