From fe60bd2490739486bb0f4492d958af8ff3ef77c9 Mon Sep 17 00:00:00 2001 From: Christian Bromann Date: Mon, 5 May 2025 12:19:42 -0700 Subject: [PATCH] docs: clarify usage of addIcons --- readme.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/readme.md b/readme.md index 85f96639..2b89d416 100644 --- a/readme.md +++ b/readme.md @@ -26,15 +26,15 @@ Also note that only visible icons are loaded, and icons that are "below the fold If you're using [Ionic Framework](https://ionicframework.com/), Ionicons is packaged by default, so no installation is necessary. Want to use Ionicons without Ionic Framework? Place the following ` - + + ``` you can replace `latest` to pick any version of Ionicon, e.g.: ```html - - + + ``` ### Basic usage @@ -58,10 +58,14 @@ To use a custom SVG, provide its url in the `src` attribute to request the exter If you have a different set of icons you would like to load or if the Ionicon icons are hosted on a different page or path, you can set the asset url from which Ionicons pulls the icons via: ```ts -import { setAssetPath } from 'ionicons' +import { setAssetPath, addIcons } from 'ionicons' +import { add, logoIonic, save } from 'ionicons/icons'; // set root path for loading icons to "/public/svg" setAssetPath(`${window.location.origin}/public/svg/`); + +// only load specific icons +addIcons({ add, logoIonic, save }); ``` This allows the use of named icons like this: