Icon
Icon renders a vector glyph that follows the surrounding text: it inherits currentColor and a 1em size unless you
set color or size. Pass an icon from the Apollion set through icon; import each icon by name so the rest of the
set is tree-shaken.Typography & Media
When to use
Use when
- A glyph represents an action or concept next to text, in buttons, lists or tables.
- You need an icon from the Apollion set, or a custom SVG that follows the theme color.
Avoid when
- The icon is the clickable element — use
IconButton. - The icon sits beside a line of copy as one unit — use
IconText. - The graphic is a logo or illustration — use
SvgorImage.
Usage
import { Icon } from '@apollion-dsi/core/elements/icon';
import { userConfig } from '@apollion-dsi/core/icons';
<Icon icon={userConfig} size="xl" color="danger" />;size takes a spacing-scale key or a number, resolved on the text-size axis: a sized icon grows with the app's
textSize. Do not rebuild a name lookup with import * as icons in product code — it pulls the whole set into the
bundle.
Other sources
Pass a custom SVG element as children; the <svg> and its groups are painted with currentColor. src fetches an SVG from a URL
and inlines it in the browser. It shows a 1em placeholder until the download finishes, so prefer icon or
children. Use one source at a time: src wins over the others, then children, then icon.
<Icon size="xl" color="danger">
<svg viewBox="0 0 24 24">
<path d="…" />
</svg>
</Icon>
<Icon src="/static/logo.svg" size="xl" />Icon set
Click an icon to copy its name. sun, moon and desktop are the light, dark and system glyphs for a theme-mode
picker.
Accessibility
- An icon is decorative by default. Add
aria-hidden="true"when text next to it already carries the meaning. - For a meaningful standalone icon from the set, pass
title: it renders as the SVG<title>. - An icon is not focusable. For an icon-only action, use
IconButtonwith a label.
Properties
Name
Type
Default
Description
containmentstringnoneContainment marker for the `cq` channel: emits
`container-type` (+ `container-name` when the string form carries one,
e.g. `'inline-size card'`). Apply on the immediate wrapper of the
adapting component — NEVER on page-level shells.
iconIconDatanoneJSON data of an icon from the set ({@link IconData}: `viewBox` + `paths`),
imported from `@apollion-dsi/core/icons` (e.g. `import { trash } from
'.../icons'`). `Icon` reads this data and assembles the `<svg>` via `Svg`.
For an arbitrary SVG element use `children`. Has lower precedence than
`children`.
iconPropsPartial<DefaultSvgInterface>noneExtra props forwarded to the inner SVG (viewBox, stroke, etc.).
@see {@link DefaultSvgInterface }
legibility"on-photo"noneReading-shadow preset for text over a photographic background
(`on-photo`). Replaces the inline `style={{ textShadow }}` in the
consumer (brasil_2030 radar, gap A3). Token emission is deferred until a
2nd consumer asks for the raw var (see backlog).
lineClampnumbernoneCaps the text at this many lines and ends the cut with an ellipsis.
The full string stays in the DOM.
pageShellbooleannoneCenters the element and caps the width at `theme.layout.pageMaxWidth`.
The page shell of a classic centered layout.
readablenumberbooleannoneMakes the `color` legible against the page surface: `true` = WCAG AA
(4.5), a number sets a custom floor. Ignored with `contrast`.
See the Layout Props concept page for the full semantics.
sizeSpacingInterfacenoneIcon size, as a spacing-scale key or unit count resolved on the **type**
axis (`theme.font.sizing`): it grows with `textSize` and ignores
`dimension`, like text. When omitted, the icon inherits the
`font-size` from context (`1em`) — useful for following text.
@example ```tsx
<Icon icon={trash} size="large" />
```
srcstringnoneURL of an external SVG. When set, triggers a `fetch` and parses the
result to insert it inline (preserving `currentColor`).
titlestringnoneAccessible title of the icon. When set, it is injected into the SVG as
`<title>` (helps screen readers). Decorative? Leave it undefined.
transformstringnoneCSS `transform` value (e.g. `translate(-50%, -33px)`). Never leaks
to the DOM as an attribute.