Icon

Draws a Hugeicons glyph as an svg in the colour of the text around it, 16px by default, hidden from screen readers unless it is named.

import {
  Add01Icon,
  Delete01Icon,
  Download01Icon,
  Edit03Icon,
  Search01Icon,
  Settings01Icon,
} from "@hugeicons/core-free-icons";
import { Icon, type IconSvgElement } from "@produkto/ui/Icon";

const icons: IconSvgElement[] = [
  Add01Icon,
  Edit03Icon,
  Delete01Icon,
  Search01Icon,
  Download01Icon,
  Settings01Icon,
];

const Example = () => (
  <div className="flex flex-wrap items-center gap-4">
    {icons.map((icon, at) => (
      <Icon icon={icon} key={at} />
    ))}
  </div>
);

export default Example;

Usage

import { Settings01Icon } from "@hugeicons/core-free-icons";
import { Icon } from "@produkto/ui/Icon";
<Icon icon={Settings01Icon} />

Examples

Sizes

size is its width and height in pixels, 16 by default.

import { Icon } from "@produkto/ui/Icon";
import { Settings01Icon } from "@hugeicons/core-free-icons";

const sizes: number[] = [16, 20, 24, 32, 40];

const Example = () => (
  <div className="flex flex-wrap items-center gap-4">
    {sizes.map((size) => (
      <Icon icon={Settings01Icon} key={size} size={size} />
    ))}
  </div>
);

export default Example;

Stroke width

strokeWidth sets how heavy its lines are, in the glyph's 24 units; without it they keep the 1.5 they are drawn at.

import { Icon } from "@produkto/ui/Icon";
import { Settings01Icon } from "@hugeicons/core-free-icons";

const strokeWidths: number[] = [1, 1.5, 2, 2.5];

const Example = () => (
  <div className="flex flex-wrap items-center gap-4">
    {strokeWidths.map((strokeWidth) => (
      <Icon icon={Settings01Icon} key={strokeWidth} strokeWidth={strokeWidth} />
    ))}
  </div>
);

export default Example;

Absolute stroke width

absoluteStrokeWidth keeps a strokeWidth the same number of pixels thick at every size, in the lower row, where by default the lines scale with the glyph, as in the upper one.

import { Icon } from "@produkto/ui/Icon";
import { Settings01Icon } from "@hugeicons/core-free-icons";

const sizes: number[] = [16, 24, 32, 48];

const Example = () => (
  <div className="flex flex-col gap-4">
    <div className="flex flex-wrap items-center gap-4">
      {sizes.map((size) => (
        <Icon icon={Settings01Icon} key={size} size={size} strokeWidth={1.5} />
      ))}
    </div>
    <div className="flex flex-wrap items-center gap-4">
      {sizes.map((size) => (
        <Icon
          absoluteStrokeWidth
          icon={Settings01Icon}
          key={size}
          size={size}
          strokeWidth={1.5}
        />
      ))}
    </div>
  </div>
);

export default Example;

Alt icon

altIcon is a second glyph that showAlt draws in place of the first, such as a tick for a moment after copying, beside one showing its own glyph as it does by default.

import { Copy01Icon, Tick02Icon } from "@hugeicons/core-free-icons";
import { Icon } from "@produkto/ui/Icon";

const Example = () => (
  <div className="flex flex-wrap items-center gap-4">
    <Icon altIcon={Tick02Icon} icon={Copy01Icon} />
    <Icon altIcon={Tick02Icon} icon={Copy01Icon} showAlt />
  </div>
);

export default Example;

API Reference

Icon

IconProps ยท components/Icon/Icon.types.ts
PropTypeDefault
sizenumber16

It also takes the props of @hugeicons/react HugeiconsIcon.