Provides a universal way of rendering registered and named icons.
<!-- Font ligature -->
<adf-icon value="alert"></adf-icon>
<!-- ADF Thumbnail Service -->
<adf-icon value="image/png"></adf-icon>
<!-- Custom icon from MatIconRegistry -->
<adf-icon value="my-company:my-icon"></adf-icon>
| Name | Type | Default value | Description |
|---|---|---|---|
| color | ThemePalette | Theme color palette for the component. | |
| value | string | Icon value, which can be either a ligature name or a custom icon in the format [namespace]:[name]. |
You can register custom SVG files as named icons in the format [namespace]:[name].
The example below shows how to register a new icon named adf:move_file
that points to an external file within the assets folder:
import { Component, OnInit } from '@angular/core';
import { MatIconRegistry } from '@angular/material/icon';
import { DomSanitizer } from '@angular/platform-browser';
@Component({...})
class AppComponent implements OnInit {
constructor(
private matIconRegistry: MatIconRegistry,
private sanitizer: DomSanitizer
) {}
ngOnInit() {
this.matIconRegistry.addSvgIconInNamespace(
'adf',
'move_file',
this.sanitizer.bypassSecurityTrustResourceUrl(
'./assets/images/adf-move-file-24px.svg'
)
);
}
}
In the HTML, you can now use the icon as shown below:
<adf-icon value="adf:move_file"></adf-icon>
You can also reference the icons registered with the Thumbnail Service
using the adf: namespace.
<adf-icon value="adf:image/gif"></adf-icon>
© 2023 Alfresco Software, Inc. All Rights Reserved.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.