fc-icon
Icon element with global icon cache.
Usage
<script>
import '@forter/icon';
</script>
<fc-icon icon="ecommerce"></fc-icon>
Example
Create blue icon and red on hover.
.custom-icon {
--fc-icon-fill: blue;
--fc-icon-fill-hover: red;
}
Examples
<fc-icon icon="ecommerce" size="40" style="--fc-icon-fill-hover:gold;" hoverable></fc-icon>
<fc-icon icon="loyalty" size="40" style="--fc-icon-fill-hover:gold;" hoverable></fc-icon>
<fc-icon icon="returns" size="40" style="--fc-icon-fill-hover:gold;" hoverable></fc-icon>
<fc-icon icon="inr" size="40" style="--fc-icon-fill-hover:gold;" hoverable></fc-icon>
<fc-icon icon="promotions" size="40" style="--fc-icon-fill-hover:gold;" hoverable></fc-icon>
<fc-icon icon="gateway" size="40" style="--fc-icon-fill-hover:gold;" hoverable></fc-icon>
<fc-icon icon="developer" size="40" style="--fc-icon-fill-hover:gold;" hoverable></fc-icon>
<fc-icon size="60" icon="ecommerce"></fc-icon>
Properties
Property | Attribute | Type | Default | Description |
---|
cache | | Map<any, any> | | Reference to the icon cache. This globally shared reference stores icons for all instance. |
fallbackIcon | fallback-icon | string | "FC_ICON_DEFAULT" | The fallback icon key for the instance |
hoverable | hoverable | boolean | false | Whether the icon will change colour when hovered. |
icon | icon | string | "" | The icon key. Used to lookup icon in the cache. Falls back to 'forter' whenever an icon is not found. example: returns |
originalFill | original-fill | boolean | false | Whether to use the icon's original 'fill' SVG property. Needed for multicolor icons or for certain types of SVG. |
size | size | number | 20 | Icon size, in pixels. Numerical values will be converted to strings e.g. 20 -> '40px', example: 80px . |
CSS Custom Properties
Property | Description |
---|
--fc-icon-fill | icon's svg fill. default: currentColor |
--fc-icon-fill-hover | icon's svg fill on hover. default: var(--cyan-5) |
--fc-icon-size | icon's size. default: 20px , example: 80px |