Shows an SVG icon from a collection of registered icons.
- Element
-
igc-icon
Remarks
The icon component renders SVG icons from registered icon collections. Icons can be:
- The internal icons that the library components use
- Registered dynamically using
registerIconorregisterIconFromText - Referenced by aliases that resolve differently based on the active theme
An alias resolves for the active theme, also inside a theme provider. The component subscribes to the icon registry and updates automatically when icons are registered or references are updated.
Example
<!-- Use an icon registered in the default collection -->
<igc-icon name="star"></igc-icon>
<!-- Use an icon from a specific collection -->
<igc-icon name="search" collection="material"></igc-icon>
<!-- Mirror the icon for RTL layouts -->
<igc-icon name="arrow-forward" mirrored></igc-icon> Properties
Section titled "Properties"collection
Section titled "collection"The registered collection to look the icon up in.
collection: string = 'default' Defined in src/components/icon/icon.ts:109
Remarks
Collections allow organizing icons into logical groups. The "default" collection is used for most icons. Custom collections can be created by registering icons with a specific collection name.
mirrored
Section titled "mirrored"Whether the icon is flipped horizontally, for example for RTL layouts.
mirrored: boolean = false Defined in src/components/icon/icon.ts:123
Remarks
When true, the icon is flipped horizontally using CSS transform. This is particularly useful for directional icons (arrows, chevrons) in right-to-left language contexts.
The name of the icon glyph to draw.
name: string = '' Defined in src/components/icon/icon.ts:95
Remarks
The icon name can be:
- A direct reference to a registered icon in the specified collection
- An alias that resolves to different icons based on the current theme
When the icon name or collection changes, the component looks up and renders the new icon in the registry.
tagName
Section titled "tagName"The tagName read-only property of the Element interface returns the tag name of the element on which it's called.
tagName: "igc-icon" = 'igc-icon' Defined in src/components/icon/icon.ts:61
Methods
Section titled "Methods"connectedCallback
Section titled "connectedCallback"connectedCallback(): void Defined in src/components/icon/icon.ts:126
Returns void
disconnectedCallback
Section titled "disconnectedCallback"disconnectedCallback(): void Defined in src/components/icon/icon.ts:137