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

InputTypeDefaultDescription
nameIconNameundefinedWhich built-in glyph to render
templateTemplateRef<unknown>|nullnullCustom SVG; overrides name when set
classstring''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

InputTypeDefaultDescription
nameIconName'spinner'Glyph rendered by the inner icon
templateTemplateRef<unknown>|nullnullCustom SVG override
variantIconPresetVariant'plain'Container treatment
sizeIconPresetSize'md'Glyph footprint + box padding
classstring''Extra class merged on the container

Variants (IconPresetVariant)

VariantSurface
plainNo box — icon sits inline (inline-flex, centered)
containedBordered white square (rounded-lg, gray border, shadow-2xs) + dark twins
softTinted round pill (rounded-full, bg-blue-50, blue text) + dark twins

Sizes (IconPresetSize)

SizeGlyphBox padding
smsmart:size-4smart:p-1.5
mdsmart:size-5smart:p-2
lgsmart:size-6smart: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 IIconOptions by 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 IconName set is closed; new built-in glyphs require a new standalone glyph component plus a @switch branch. 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.

ExportKindWhat it is
SmartIconcomponentOne of the library's glyphs, or a custom template.
SmartIconSpinnercomponentThe spinner glyph (an animated SVG).
SmartIconChevronDowncomponentThe chevron-down glyph.
SmartIconChevronUpcomponentThe chevron-up glyph.
SmartIconPresetcomponentStyled 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

PropTypeDefaultDescription
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.

PropTypeDefaultDescription
className?string—Classes on the SVG.

SmartIconPresetProps

Props of SmartIconPreset.

PropTypeDefaultDescription
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.
  • 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 the size-* 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.
  • SmartIconPreset adds the container classes per variant and size, with smart: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.