Icon
The Icon component provides a consistent way to display Material Symbols and custom SVG icons across Halstack applications. It helps users recognize actions, understand information, and navigate interfaces through visual representation while maintaining consistency in appearance, sizing, color and accessibility.
| Name | Type | Description | Default |
|---|---|---|---|
ariaLabel | string | Accessible name of the icon. Set it only when the icon conveys meaning on its own; otherwise the icon is hidden from assistive technologies. | - |
Required icon | string | SVG | Name of the Material Symbols icon to display (for example "add_card"). Prefix the name with "filled_" (for example "filled_add_card") to render the filled variant. An SVG element can also be passed, in which case it is rendered as is. | - |
| size | string | Font size of the icon. Use a design token or a CSS value. For custom SVG icons, it sets the height of the SVG. If no size is provided, Material Symbols icons inherit the font size of their parent, and custom SVG icons use var(--height-s) as height. | - |
| color | string | Color of the icon. Use a design token or a CSS color. For custom SVG icons, it sets the fill of the SVG. If no color is provided, the icon inherits the color of its parent text. | - |
() => ( <DxcInset space="var(--spacing-padding-xl)"> <DxcFlex gap="var(--spacing-gap-xl)" alignItems="center"> <DxcIcon icon="home" /> <DxcIcon icon="filled_home" size="var(--typography-label-l)" color="var(--color-fg-primary-medium)" /> <DxcIcon icon="favorite" size="var(--typography-heading-xl)" color="var(--color-fg-error-medium)" /> </DxcFlex> </DxcInset> )
() => { const icon = ( <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-label="info" > <path d="M11 17H13V11H11V17ZM12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM12 20C7.59 20 4 16.41 4 12C4 7.59 7.59 4 12 4C16.41 4 20 7.59 20 12C20 16.41 16.41 20 12 20ZM11 9H13V7H11V9Z" /> </svg> ); return ( <DxcInset space="var(--spacing-padding-xl)"> <DxcFlex gap="var(--spacing-gap-xl)" alignItems="center"> <DxcIcon icon={icon} /> <DxcIcon icon={icon} size="2rem" color="var(--color-fg-secondary-medium)" /> </DxcFlex> </DxcInset> ); }