Icon
Display a glyph from the shared icon set to reinforce nearby text and actions.
Installation
- Install the package.
npm install @hashintel/ds-components- 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
altwhen 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
iconNameandtooltip, which add focus, hover, and an accessible name. - Don't: Don't place Icon manually inside components with an
iconNameprop (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
altswitches the SVG torole="img"with the text as itsaria-label, announcing it like an image.
What you must do
- Set
altonly 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", notalt="Lock". - Never attach click handlers to a bare Icon — interactive glyphs belong on Button, which provides focus and an accessible name.
API reference
Icon
| Prop | Type |
|---|---|
| name | "function" | "filter" | "at" | "circle" | … 137 more |
| size | "xxs" | "xs" | "sm" | "md" | "lg" default: "md" |
| alt | string |
Styling
- Use
--icon-sizeto set a custom size for an icon.
Was this page helpful?