Icons

@surfaces-ui/icons is one set of 192 outline icons: 180 from Lucide for everyday use, and 12 drawn for Surfaces UI for data work that Lucide has no icon for (joins, lineage, pivots, schema drift and more). Both are drawn at one weight, so they read as one family. Search them, and copy the code for one, on the Icons page.

Choose an icon

  • Choose by meaning. A name says what an icon means (undo, left-join, remove), never what it looks like. Use it for that meaning and no other, so a person learns it once.
  • Words first. An icon beside words is read faster. Use one alone only where its meaning is common (close, search, undo) and the button has a name.
  • The data icons need words more than most. dimension and semantic-model are not yet known to people by sight.
  • Find one. The Icons page searches names, meanings, categories and other words for the same thing, so "bin" finds remove. In code, searchIcons({ text, group, source }) from @surfaces-ui/icons/search does the same.

Size and weight

Icons are drawn on a 24 by 24 grid and checked at 16, 20 and 24 pixels. With no size, an icon is a little larger than the text beside it and grows with it. Use 16 in dense controls, 20 in buttons and rails, and 24 alone or beside a heading.

The line weight of every icon is --sf-icon-stroke (1.6), which the theme sets. Do not set a stroke width on one icon. An icon takes the text's color.

Labels

  • Beside words that say the same, give no label. The icon is decoration and a screen reader skips it.
  • Alone in a button, name the button (aria-label) and leave the icon without one.
  • Alone and not in a button, such as a mark in a table cell, give the icon a label. It is then read as an image with that name.

Never let an icon or its color be the only thing that says something; see accessibility.md.

In React

bash
npm install @surfaces-ui/icons

Import the icons you use. Only their drawings are in your bundle.

tsx
import { Icon, leftJoinIcon, undoIcon } from "@surfaces-ui/icons";

<button type="button" aria-label="Undo">
  <Icon icon={undoIcon} />
</button>;
<Icon icon={leftJoinIcon} size={20} label="Left join" />;

For a name known only as the app runs, check it and take the drawing from the whole set. ICONS holds all of them, so load it only where you need it.

tsx
import { Icon, isIconName } from "@surfaces-ui/icons";
import { ICONS } from "@surfaces-ui/icons/all";

{isIconName(name) && <Icon icon={ICONS[name]} />}
EntryWhat it holds
@surfaces-ui/iconsIcon, each drawing (undoIcon), ICON_NAMES, IconName, isIconName, iconFrame
@surfaces-ui/icons/icons/undoOne drawing
@surfaces-ui/icons/allICONS: every drawing by name
@surfaces-ui/icons/groupsICON_GROUPS: the names by category, with no drawings
@surfaces-ui/icons/infoICON_INFO: each icon's source, category, meaning and other words
@surfaces-ui/icons/searchsearchIcons, ICON_GROUP_LABELS

In a surface an agent draws

Icon is in every catalog. It takes name, size (16, 20 or 24) and label. An agent is shown a short sample of the names and may try others. A name that is not in the set is refused with up to five that are closest, and costs only itself: the rest of the surface is drawn, and the agent is told in the same call where it draws through a tool, or on its next turn. Every name is on Icon's page. The drawings load when the first icon is drawn, so an app whose surfaces hold none does not load them.

As A2UI:

json
{ "id": "join", "component": "Icon", "name": "left-join", "size": 20, "label": "Left join" }

As a json-render spec:

json
{ "root": "root", "elements": { "root": { "type": "Icon", "props": { "name": "left-join", "size": 20, "label": "Left join" } } } }

As JSX markup:

tsx
import { analyticsMarkup as Ui } from "@surfaces-ui/spec/react";

<Ui.Icon name="left-join" size={20} label="Left join" />;

Other components do not take an icon yet.

Add an icon

  1. Look in Lucide first. If it has a good one, add it to packages/icons/scripts/lucide.mjs under a name for what it means.
  2. If not, draw one in packages/icons/drawings/<name>.svg. Drawings are original; do not copy another library's.
  3. Say what it means, and the other words for it, in packages/icons/scripts/meanings.mjs.
  4. Run pnpm --filter @surfaces-ui/icons gen, then pnpm build, pnpm docs:gen and pnpm test.
  5. Look at it on the Icons page at 16 pixels, beside its neighbors, in light and dark.

The drawing rules, which the tests hold:

  • A 24 by 24 grid, with every line inside 2 to 22.
  • Outline only, with round caps and joins that Icon sets. No color, weight or dash of its own.
  • Corners of 2 on a large shape and 1 on a small one, and about 3 units between parallel lines (less closes up at 16 pixels).
  • One drawing has one name. A name is public, so renaming one is a breaking change.

License

Lucide's icons are used under the ISC License, and those it took from Feather under the MIT License. Both notices are in NOTICE, which every package carries. The Surfaces UI drawings are under this repository's license.