Icon

Display a glyph from the shared icon set to reinforce nearby text and actions.

Installation

  1. Install the package.
npm install @hashintel/ds-components
  1. Import the component.
import { Icon } from "@hashintel/ds-components";

export const FlowRunStatus = () => (
  <span>
    <Icon name="circleCheck" size="sm" /> Flow completed
  </span>
);

When to use

  • Do: Use Icon to reinforce meaning next to text: status rows, metadata labels, empty states.
  • Do: Use alt when an icon stands alone and carries meaning of its own.

When not to use

  • Don't: Don't make a bare Icon clickable — use Button's iconName and tooltip, which add focus, hover, and an accessible name.
  • Don't: Don't place Icon manually inside components with an iconName prop (Button, Chip, Banner, Select) — the slot sizes and spaces it for you.
  • Don't: Don't use icons for people or workspaces — use Avatar, which handles images and fallback initials.

Examples

Basic

name picks a glyph from the set. Icons render at md and are hidden from assistive technology by default.

Sizes

Five fixed steps: xxs, xs, sm, md (the default), and lg. Match the step to the surrounding text or control — sm pairs with body text, md and up with headings and empty states.

Color

Glyphs fill with currentColor, so an icon takes the surrounding text color — including the hover and state colors of a parent component. There is no color prop; set a text color on the icon or a wrapper.

Run failed

Accessibility

What Icon provides

  • Renders aria-hidden="true" by default, so decorative icons are invisible to assistive technology.
  • Setting alt switches the SVG to role="img" with the text as its aria-label, announcing it like an image.

What you must do

  • Set alt only when the icon carries meaning nearby text doesn't — labelling an icon that sits next to the same words announces it twice.
  • Describe the meaning, not the glyph: alt="Private entity type", not alt="Lock".
  • Never attach click handlers to a bare Icon — interactive glyphs belong on Button, which provides focus and an accessible name.

API reference

Icon

PropType
name
"function" |⁠ "filter" |⁠ "at" |⁠ "circle" |⁠ … 137 more
size
"xxs" |⁠ "xs" |⁠ "sm" |⁠ "md" |⁠ "lg"
default: "md"
alt
string

Styling

  • Use --icon-size to set a custom size for an icon.

Was this page helpful?

On this page