Fair Case

Icons

The one door for the house icon set. Each icon is a function that draws one licensed glyph at one of four sizes, in the current colour, with a 1.5px line. This page is the API; the Icons page shows the set.

Sizes and colour

Four sizes. The last icon is left at its usual size and takes its colour from a class, since an icon draws in the current colour.

xs · 12
sm · 16
md · 20
lg · 24
usual · text-accent

TSX

<SearchIcon size="xs" />
<SearchIcon size="sm" />
<SearchIcon size="md" />
<SearchIcon size="lg" />
<SearchIcon className="text-accent" />

How an icon is made

Every export is one line that hands drawIcon a licensed glyph, a short data-icon name and the icon's usual size. drawIcon sets the box from ICON_PX, adds the iconVariants classes and the data-icon attribute, and lets the caller's className win.

TSX

export function SearchIcon(props: IconProps) {
  return drawIcon(IconMagnifyingGlass, "search", "sm", props);
}

The exports

icons.tsx exports 30 icons, one function each, beside ICON_PX, iconVariants and the two types in the Props table. The Icons page lists every icon with its glyph, its usual size and where it is used.

InfoIcon and MailIcon are not exported here. Each has its own file, so a route that needs one glyph does not load the rest: see Info icon and Mail icon.

Code

TSX

import { CloseIcon, SearchIcon } from "@repo/ui/icons";

<SearchIcon />
<CloseIcon size="lg" />
<SearchIcon className="text-accent" />

Every icon takes the same two props. Left alone, an icon draws at its usual size.

Variants

Variants
PropValueHow it looks
sizexs12px box (size-3). The usual size of 1 icon.
sizesm16px box (size-4). The usual size of 15 icons.
sizemd20px box (size-5). The usual size of 14 icons.
sizelg24px box (size-6). No icon takes it by default.
line1.5pxEvery line glyph draws a 1.5px line at every size (icons.css), so the set reads as one weight. The solid glyphs (play, pause, stop) have no stroke.
colourcurrentColorEvery icon draws in the current colour, so the wrapper sets it.
data-iconthe glyph's nameEach icon carries data-icon, such as "search", for tests. icons.css keys the line rule on it.
exportfunctionEach icon is a function declaration, not the result of a call, so the bundler can drop one no client code uses.

States

States
StateHow it looks
restA static, decorative glyph. The control that holds it carries the accessible name.
hovernot written
focusnot written
disablednot written

Props

Import from @repo/ui/icons.

Props
PropTypeDefaultWhat it does
size"xs" | "sm" | "md" | "lg"default usualThe icon's box. Left out, it takes the glyph's usual size, which the Icons page lists. Never a number.
classNamestring | undefinedMerged after the size classes.
ICON_PX{ xs: 12, sm: 16, md: 20, lg: 24 }The size scale in pixels. An icon that needs another size adds a step here.
iconVariantscva functionThe size classes, with shrink-0. Exported so a wrapper can match an icon's box.
IconSizetypeThe scale's four names.
IconProps{ className?, size? }What every icon takes.

Use it well

  • Pass size xs, sm, md or lg, never a number. An icon that needs another size adds a step to ICON_PX first.

  • Name the control, not the icon. An icon is aria-hidden, so give its button a label.

  • To add an icon, add one function to icons.tsx that passes the glyph, a short data-icon name and its usual size to drawIcon. icons.test.ts counts the exports.

  • A glyph only one page uses gets its own file, so it does not ship on every page: InfoIcon and MailIcon.

  • The licensed glyphs are installed from the registry at build time. Never copy one into the repository.