Skip to content

Commit 07bb596

Browse files
committed
Add an example for the alteration of icons on runtime
Closes #338
1 parent 9e30d71 commit 07bb596

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

docs/migration/wsc55/icons.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,15 @@ element.innerHTML = '<fa-icon name="bell" solid></fa-icon>';
102102
You can alter the size by changing the `size` property which accepts the numbers `16`, `24`, `32`, `48`, `64`, `96`, `128` and `144`.
103103
The icon itself should be always set through the `setIcon(name: string, isSolid: boolean)` function which validates the values and rejects unknown icons.
104104

105+
```ts
106+
const div = document.createElement("div");
107+
div.innerHTML = '<fa-icon name="user"></fa-icon>';
108+
109+
const icon = div.querySelector("fa-icon");
110+
icon.size = 24;
111+
icon.setIcon("bell", true);
112+
```
113+
105114
## Migrating Icons
106115

107116
We provide a helper script that eases the transition by replacing icons in templates, JavaScript and TypeScript files.

0 commit comments

Comments
 (0)