Icon

Renders an SVG glyph from the kit's icon registry at 1em in the current text color. The kit ships the glyphs its own components need; register your own with provideVigdxIcons .

  • vig-icon
Import
import { Icon, provideVigdxIcons } from '@vigdx/ui/icon';

Default icons

Every glyph in VIG_DEFAULT_ICONS , the built-in set the kit's components use. Pass its key as name .

  • close
  • check
  • chevron-down
  • chevron-up
  • chevron-left
  • chevron-right
  • chevrons-left
  • chevrons-right
  • chevrons-up
  • chevrons-down
  • arrow-up
  • arrow-down
  • sort
  • grip-vertical
  • eye
  • eye-off
  • info
  • success
  • warning
  • error
  • calendar
  • filter
  • filter-filled
  • columns
  • download
  • minus
  • plus
  • search
  • external-link
  • user
  • more-horizontal
  • inbox
  • menu
  • list
  • grid
  • home
  • upload
  • file
  • star
  • pipette
  • play
  • pause
  • zoom-in
  • zoom-out
  • rotate-cw
  • rotate-ccw
  • maximize

Size and color

An icon is 1em square and stroked with currentColor : size it with a font-size class and color it with a text color. strokeWidth makes a single glyph bolder or lighter.

Inline icons sit on the text baseline and follow its size.

Meaningful icons

Icons are decorative by default. When an icon carries information that no nearby text gives, pass an ariaLabel ; next to a text label, leave it decorative.

Two-factor login
Recovery email
Backup codes
Not generated

Custom icons

provideVigdxIcons merges glyphs into the registry by name, adding new ones or overriding built-ins. An IconDefinition is SVG path data on a 24×24 viewBox ; outline by default, filled with fill: 'currentColor' .

Styling hooks

Internal elements carry a stable data-part and the component's data-scope; both are public API, so removing one is a breaking change. Select a part by both, e.g. [data-scope="icon"][data-part="svg"] { … }: the pair stays within this component when kit components nest, and also reaches parts in overlay panels, which render outside the host. State is exposed through aria-* and, where listed, a data-state; literal values are checked by the API gate, values computed from the component's state follow its documented types. Other data-* attributes listed below (such as data-opening while an overlay animates) are API too. See Customizing.

Scope: [data-scope="icon"]

Icon styling hooks
Part Element data-state
svg The inline <svg> . —

Accessibility

  • By default the icon is aria-hidden="true" and its SVG is not focusable, so screen readers skip it.
  • With ariaLabel the icon becomes role="img" with that name. Use it only when the icon is the sole carrier of the information.
  • Icon-only controls get their name from the control, not the icon: pass ariaLabel to the button and keep the icon decorative.
  • Meaningful icons need a 3:1 contrast against their background (WCAG 1.4.11); never use color alone to tell states apart.
  • Glyphs are path data rendered by Angular bindings, not HTML strings, so no innerHTML or sanitizer bypass is involved.

API

Icon

vig-icon component

Renders a registered icon at 1em in the current text color. Decorative by default (hidden from assistive tech); pass ariaLabel for a meaningful one. Size it with the font size, e.g. class="text-[1.25em]".

Icon props
Name Type Default Description
ariaLabelstring | undefinedundefined

Accessible name; when set the icon is exposed as role="img".

name required string—

Name of a registered icon (see VIG_DEFAULT_ICONS and provideVigdxIcons).

strokeWidthnumber | undefinedundefined

Per-instance stroke width override, e.g. a bolder check inside a small box.

Are you sure?