Install

bash
pnpm add @reactloom/icons

The package has no stylesheet and depends only on React. Each icon is a separate export, so a bundler includes just the icons you import: one icon costs about 0.4 kB, all 140 about 4 kB (minified and brotli-compressed, measured in CI).

Usage

Decorative, directional and labelled icons

Preview
Example.tsx
import { ArrowRightIcon, CheckCircleIcon, TrashIcon } from '@reactloom/icons';
import { Button, Stack, Text } from '@reactloom/ui';

export default function Example() {
  return (
    <Stack direction="row" gap="3" align="center" wrap>
      {/* Next to visible text: decorative, no label. */}
      <Button variant="secondary" startIcon={<TrashIcon />}>
        Delete
      </Button>
      {/* Directional icons flip in right-to-left layouts. */}
      <Button endIcon={<ArrowRightIcon />}>Continue</Button>
      {/* On its own and meaningful: give it a label. Colour follows the text. */}
      <Text as="span" style={{ color: 'var(--pl-color-success-fg)', fontSize: 'var(--pl-font-size-xl)' }}>
        <CheckCircleIcon label="Synced" />
      </Text>
    </Stack>
  );
}
  • Size defaults to 1em, so an icon matches its text. Pass size (a number of pixels or any CSS length) to fix it.
  • Colour is currentColor: set color on the icon or its parent. Other SVG props such as strokeWidth pass through.
  • ref, className and style reach the <svg>.

Accessibility

  • Without label an icon is decorative: aria-hidden, so a screen reader reads only the text beside it. This is right for icons inside labelled buttons and next to visible text.
  • With label it becomes role="img" with that name. Use it when the icon carries meaning on its own, such as a status with no text. For an icon-only button, put the name on the button (IconButton’s label) and leave the icon decorative.
  • Icons never receive keyboard focus.
  • In Windows high-contrast mode, strokes follow the text colour because they use currentColor.

Right-to-left layouts

Icons that point in the reading direction — arrows, chevrons, undo and redo, send, log in and out, lists — are marked directional in the gallery and flip horizontally when the page or a container has dir="rtl". The flip reads the --pl-dir variable that @reactloom/theme sets from dir; without the theme, set --pl-dir: -1 on right-to-left containers yourself.

Override per icon with mirrored: mirrored={false} keeps an arrow fixed (a compass direction, a “sort ascending” arrow), and mirrored flips any other icon. Icons that represent physical objects or time, such as a clock or a play button, are not mirrored by default.

Your own icons

createIcon gives your icons the same props, accessibility and mirroring. Draw them on a 24×24 grid with 2-unit round strokes so they sit well next to the set; pass { directional: true } as the third argument for icons that should flip.

A custom icon

Preview
Example.tsx
import { createIcon } from '@reactloom/icons';
import { Button } from '@reactloom/ui';

// Draw on a 24-unit grid; the set uses 2-unit round strokes and inherits currentColor.
const RocketIcon = createIcon(
  'RocketIcon',
  <>
    <path d="M12 3c3.5 2 5 5.5 5 9.5L14.5 15h-5L7 12.5C7 8.5 8.5 5 12 3z" />
    <path d="M9.5 15L8 20l4-2 4 2-1.5-5" />
    <circle cx="12" cy="9.5" r="1.5" />
  </>,
);

export default function Example() {
  return (
    <Button startIcon={<RocketIcon />}>Launch</Button>
  );
}

Using another icon library

ReactLoom components accept any React element where they take an icon (Button’s startIcon and endIcon, Sidebar.Item’s icon, EmptyState’s icon), so you can use lucide-react, Heroicons or your design system’s icons instead. Most stroke icon sets also use a 24-unit grid and currentColor, so they size and colour the same way. You lose automatic right-to-left mirroring unless you add it.