Icon
Inline SVG glyph primitive. <smart-icon> dispatches over a fixed IconName set via @switch, rendering one of the standalone glyph components. Unlike the other component groups the icon has no *_STANDARD_COMPONENT_TOKEN and no IIconOptions — it is configured entirely through direct inputs.
Usage
<smart-icon [name]="name" [class]="iconClass" />
<ng-template #heart>
<svg
data-icon="heart"
viewBox="0 0 24 24"
fill="currentColor"
class="smart:size-6 smart:text-pink-500"
>
<path
d="M12 21s-7.5-4.6-9.5-9.2C1 8.3 3.4 5 6.8 5c2 0 3.4 1.1 4.2 2.4C11.8 6.1 13.2 5 15.2 5 18.6 5 21 8.3 19.5 11.8 17.5 16.4 12 21 12 21z"
/>
</svg>
</ng-template>
<smart-icon [template]="heart" />
The preview renders the code above in an application that registers every preset (provideSmartPresets(), see Installation) and the English translations; without the presets, a component that has one renders its standard implementation instead, for most components unstyled markup.
Public API
smart-icon
| Input | Type | Default | Description |
|---|---|---|---|
name | IconName | undefined | Which built-in glyph to render |
template | TemplateRef<unknown>|null | null | Custom SVG; overrides name when set |
class | string | '' | Extra CSS class forwarded to the glyph (not applied to a template) |
class is the alias of the internal cssClass input (input('', { alias: 'class' })).
IconName
IconName is 'spinner' | 'chevron-down' | 'chevron-up'; <smart-icon> renders nothing for another value.
Each value maps to a standalone glyph component that renders a raw <svg> (smart:size-5 plus the class; the spinner also spins): IconSpinnerComponent (smart-icon-spinner), IconChevronDownComponent (smart-icon-chevron-down) and IconChevronUpComponent (smart-icon-chevron-up). They extend IconBaseComponent, which declares the cssClass input (alias class).
Dispatch
The wrapper picks the branch with @switch (name()); when template() is set it renders [ngTemplateOutlet] instead and ignores name.
Preset
<smart-icon-preset> (IconPresetComponent) composes <smart-icon> inside a themed container. It is composition, not inheritance — it does not extend the base icon; it renders one and wraps it. Because there is no token, the preset is used through its selector directly (there is nothing to register).
Inputs
| Input | Type | Default | Description |
|---|---|---|---|
name | IconName | 'spinner' | Glyph rendered by the inner icon |
template | TemplateRef<unknown>|null | null | Custom SVG override |
variant | IconPresetVariant | 'plain' | Container treatment |
size | IconPresetSize | 'md' | Glyph footprint + box padding |
class | string | '' | Extra class merged on the container |
Variants (IconPresetVariant)
| Variant | Surface |
|---|---|
plain | No box — icon sits inline (inline-flex, centered) |
contained | Bordered white square (rounded-lg, gray border, shadow-2xs) + dark twins |
soft | Tinted round pill (rounded-full, bg-blue-50, blue text) + dark twins |
Sizes (IconPresetSize)
| Size | Glyph | Box padding |
|---|---|---|
sm | smart:size-4 | smart:p-1.5 |
md | smart:size-5 | smart:p-2 |
lg | smart:size-6 | smart:p-2.5 |
plain ignores the padding (no box). The container is exposed via data-role="icon-preset" for testing.
Documented Gaps / Limitations
- No token and no
IIconOptionsby design — the icon and its preset are configured through direct inputs only, so<smart-icon>cannot be globally reskinned the way token-driven components can. - The
IconNameset is closed; new built-in glyphs require a new standalone glyph component plus a@switchbranch. For one-off SVGs use[template].
Source
The component lives in packages/shared/angular/src/lib/components/icon and is documented for Claude Code by the angular-components-icon skill.
SmartIcon renders one of the library's three glyphs by name (spinner, chevron-down, chevron-up) or, when template is given, that node instead. It renders nothing for an unknown name. The glyph components (SmartIconSpinner, SmartIconChevronDown, SmartIconChevronUp) are exported too. SmartIconPreset wraps the icon in a themed container (plain, contained, soft) in three sizes. The icon has no registry key: use template for your own icon, or the preset directly.
Usage
import { SmartIcon } from '@smartsoft001/react';
export function IconUsageExample() {
return (
<>
<SmartIcon
name="chevron-down"
className="smart:size-6 smart:text-gray-500"
/>
<SmartIcon
template={
<svg
data-icon="heart"
viewBox="0 0 24 24"
fill="currentColor"
className="smart:size-6 smart:text-pink-500"
>
<path d="M12 21s-7.5-4.6-9.5-9.2C1 8.3 3.4 5 6.8 5c2 0 3.4 1.1 4.2 2.4C11.8 6.1 13.2 5 15.2 5 18.6 5 21 8.3 19.5 11.8 17.5 16.4 12 21 12 21z" />
</svg>
}
/>
</>
);
}
The preview renders the code above in an application that registers every preset (SMART_PRESET_COMPONENTS on SmartProvider, see Installation) and the English translations; without the presets, a component that has one renders its standard implementation instead, for most components unstyled markup.
Exports
All from @smartsoft001/react.
| Export | Kind | What it is |
|---|---|---|
SmartIcon | component | One of the library's glyphs, or a custom template. |
SmartIconSpinner | component | The spinner glyph (an animated SVG). |
SmartIconChevronDown | component | The chevron-down glyph. |
SmartIconChevronUp | component | The chevron-up glyph. |
SmartIconPreset | component | Styled icon variation (preset): <SmartIcon> inside a themed container, across a plain / contained / soft variant scale in sm / md / lg. |
The preset's class helpers (getIconSizeClasses, getIconContainerClasses) are exported too, for a custom implementation that wants the preset look.
Props and Types
SmartIconProps
| Prop | Type | Default | Description |
|---|---|---|---|
name? | IconName | — | The glyph; renders nothing without a name or template, or for an unknown name. |
className? | string | — | Classes on the SVG of the glyph. |
template? | ReactNode | — | Rendered instead of the named glyph. |
SmartIconGlyphProps
Props of the glyph components.
| Prop | Type | Default | Description |
|---|---|---|---|
className? | string | — | Classes on the SVG. |
SmartIconPresetProps
Props of SmartIconPreset.
| Prop | Type | Default | Description |
|---|---|---|---|
name? | IconName | 'spinner' | The glyph inside the container. |
template? | ReactNode | — | A node rendered instead of the glyph. |
variant? | IconPresetVariant | 'plain' | The container treatment. |
size? | IconPresetSize | 'md' | The container footprint. |
className? | string | — | Classes on the container. |
Related types
IconName:'spinner' \| 'chevron-down' \| 'chevron-up'— The glyph names.IconPresetVariant:'plain' \| 'contained' \| 'soft'— Visual treatment applied around the icon glyph.IconPresetSize:'sm' \| 'md' \| 'lg'— Icon footprint on thesize-*scale.
Replacing the Implementation
SmartIcon has no SmartProvider registry key, so it cannot be replaced application-wide. Pass your own node through template (it is rendered as is), use SmartIconPreset for a themed container, or render the glyph components directly. Components that show a spinner or a chevron (button, accordion, input loader) render SmartIcon themselves.
Styling
- The glyphs are inline SVGs that take
currentColor, so they follow the text colour (and dark mode) of their parent. SmartIconPresetadds the container classes pervariantandsize, withsmart:dark:variants.
Source
The component lives in packages/shared/react/src/lib/components/icon and is documented for Claude Code by the react-components-icon skill.