Icon
Renders an SVG icon by name from the Phosphor or Lucide library, or from icons you register yourself.
<arc-icon>Overview
Icon looks up name in the icon registry, runs the SVG through a sanitizer that strips <script> elements and on* handler attributes, and renders the result in its shadow root. Sanitized SVGs are cached, so each one is processed once.
Each of the 3,400+ icons is its own module (Lucide icons average 500 bytes and Phosphor icons 660), and <arc-icon name="star"> fetches only star.js. Importing arc-icon brings no icon library with it, only the nine glyphs ARC UI's own buttons draw (close, chevrons, overflow, edit, play and pause).
The icons ship separately in @arclux/arc-ui-icons. It has two libraries: Phosphor Icons (phosphoricons.com), 1,512 glyphs drawn as filled paths, and Lucide (lucide.dev), a community fork of Feather Icons with 1,896 stroke-based glyphs. Click any icon in the browser below to copy its name.
Install it and import a pack. One line registers it, and if nothing else has been selected it becomes the active library, so <arc-icon name="star"> works on the next line:
import '@arclux/arc-ui-icons/phosphor';
Nothing is selected by default. Until a pack registers, a named icon renders its slot fallback (unless it's one of the nine built-in glyphs) and the registry logs a warning saying why. Before v4 both packs were vendored inside @arclux/arc-ui, where they were 88% of the published files and 44% of the unpacked bytes of every install.
To switch libraries for the whole page, use the iconRegistry API or the <arc-icon-library> element:
// JavaScript API
import { iconRegistry } from '@arclux/arc-ui';
iconRegistry.use('lucide'); // switch all icons to Lucide (no data loaded until icons render)
<!-- Declarative (place anywhere in the document) -->
<arc-icon-library name="lucide"></arc-icon-library>
You can register your own icons, such as a logo, on top of the active library and use them alongside its icons. Icons registered with set() resolve with no network request:
iconRegistry.set({
'my-logo': '<svg viewBox="0 0 24 24">...</svg>',
'custom-chart': '<svg viewBox="0 0 24 24">...</svg>',
});
If your app uses a handful of icons, skip the pack registration and import those glyphs directly. That pulls in one module per icon and no resolver at all:
import { iconRegistry } from '@arclux/arc-ui';
import check from '@arclux/arc-ui-icons/phosphor/check';
import x from '@arclux/arc-ui-icons/phosphor/x';
iconRegistry.set({ check, x });
To load a whole library in one import, for an icon picker say, use the all entry points:
import phosphor from '@arclux/arc-ui-icons/all/phosphor'; // loads all ~1,500 icons
import lucide from '@arclux/arc-ui-icons/all/lucide'; // loads all ~1,900 icons
Guidelines
Do
- Give an icon a `label` when it carries meaning, such as a status or an action
- Leave `label` off decorative icons so screen readers skip them
- Size icons with the `size` prop, not CSS
- Register custom icons with `iconRegistry.set()` before they first render
Don't
- Don't render SVG strings from user input without sanitizing them yourself first
- Don't use `xl` for icons in running text. `sm` or `md` matches body copy
- Don't set both `name` and slot content. When the name resolves, the slot is ignored
- Don't let an icon carry critical information on its own. Pair it with visible text
- Don't hardcode fill or stroke colors in registered SVGs. Use `currentColor` so they follow the text color
Features
- Sizes: `xs` (12px), `sm` (16px, the default), `md` (20px), `lg` (24px) and `xl` (32px)
- Takes its color from the parent through `currentColor`
- Renders its default slot when the registry has no icon by that name, so an inline SVG works as a fallback
- With `label`, the icon gets `role="img"` and that `aria-label`. Without it, `role="presentation"` and `aria-hidden="true"`
Preview
Usage
<!-- Basic usage, once a pack is registered (see the Registry API tab) -->
<arc-icon name="star" size="sm"></arc-icon>
<arc-icon name="heart" size="md"></arc-icon>
<arc-icon name="gear" size="lg"></arc-icon>
<!-- Accessible icon with label -->
<arc-icon name="warning" size="md" label="Warning"></arc-icon>
<!-- Switch to Lucide globally -->
<arc-icon-library name="lucide"></arc-icon-library>import { iconRegistry } from '@arclux/arc-ui';
import '@arclux/arc-ui-icons/lucide';
// Switch all icons to Lucide
iconRegistry.use('lucide');
// List all available icon names (async — loads manifest lazily)
const names = await iconRegistry.list(); // active library
const phosphor = await iconRegistry.list('phosphor'); // specific library
// Register custom icons (merged on top of active library)
iconRegistry.set({
'my-logo': '<svg viewBox="0 0 24 24">...</svg>',
});
// Look up an icon by name (async — loads single icon lazily)
const svg = await iconRegistry.get('star'); // returns SVG string or nullimport { Icon } from '@arclux/arc-ui-react';
export default function Example() {
return (
<>
<Icon name="star" size="sm" />
<Icon name="heart" size="md" />
<Icon name="gear" size="lg" label="Settings" />
</>
);
}<script setup>
import { Icon } from '@arclux/arc-ui-vue';
</script>
<template>
<Icon name="star" size="sm" />
<Icon name="heart" size="md" />
<Icon name="gear" size="lg" />
</template><script>
import { Icon } from '@arclux/arc-ui-svelte';
</script>
<Icon name="star" size="sm" />
<Icon name="heart" size="md" />
<Icon name="gear" size="lg" />import { Component } from '@angular/core';
import { Icon } from '@arclux/arc-ui-angular';
@Component({
imports: [Icon],
template: `
<arc-icon name="star" size="sm"></arc-icon>
<arc-icon name="heart" size="md"></arc-icon>
<arc-icon name="gear" size="lg"></arc-icon>
`,
})
export class MyComponent {}import { Icon } from '@arclux/arc-ui-solid';
export default function Example() {
return (
<>
<Icon name="star" size="sm" />
<Icon name="heart" size="md" />
<Icon name="gear" size="lg" />
</>
);
}import { Icon } from '@arclux/arc-ui-preact';
export default function Example() {
return (
<>
<Icon name="star" size="sm" />
<Icon name="heart" size="md" />
<Icon name="gear" size="lg" />
</>
);
}<!-- Auto-generated by @arclux/prism — do not edit manually -->
<!-- arc-icon — requires icon.css + base.css (or arc-ui.css) -->
<span class="arc-icon">
<span
class="icon"
role="presentation"
aria-label="Label"
aria-hidden="true"
>
</span>
</span><!-- Auto-generated by @arclux/prism — do not edit manually -->
<!-- arc-icon — self-contained, no external CSS needed -->
<span class="arc-icon" style="display: inline-flex; align-items: center; justify-content: center; color: currentColor; vertical-align: middle">
<span
style="display: flex; align-items: center; justify-content: center; width: 100%; height: 100%"
role="presentation"
aria-label="Label"
aria-hidden="true"
>
</span>
</span>API
namestring''- Icon name to look up in the icon registry. When provided, renders the matching SVG. When empty, falls back to slotted content.
size'xs' | 'sm' | 'md' | 'lg' | 'xl''sm'- Icon dimensions:
xs(12px),sm(16px),md(20px),lg(24px),xl(32px). labelstring''- Accessibility label. When provided, sets
role="img"andaria-label. When empty, setsrole="presentation"andaria-hidden="true".