Skip to content

Commit

Permalink
docs: describe preloading of icons
Browse files Browse the repository at this point in the history
  • Loading branch information
nuke-ellington committed Jan 9, 2025
1 parent 8e1bb3f commit 9f68b90
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ SPDX-License-Identifier: MIT

## Usage

Using icons within your project. You need to:
### Installation

First install the package `@siemens/ix-icons` in your project (e.g. `npm install --save @siemens/ix-icons`).

- Install `@siemens/ix-icons` e.g. `npm install --save @siemens/ix-icons`
Then load the icon component:

```javascript
import { defineCustomElements } from '@siemens/ix-icons/loader';
Expand All @@ -24,6 +26,21 @@ import { defineCustomElements } from '@siemens/ix-icons/loader';
})();
```

Icons are loaded once and then cached for the entire duration of the single-page application.
Additionally, icons can be preloaded to ensure they are immediately available from the cache when needed later:

```javascript
import { loadIcons } from '@siemens/ix-icons';

const icons = [
'star',
'star-filled',
// ...
];

loadIcons(icons)
```

### Angular / Web Components

```html
Expand Down

0 comments on commit 9f68b90

Please sign in to comment.