Skip to content

Commit f93cbb7

Browse files
author
tfsbuild
committed
Adding changes from build igniteui-xplat-docs-make-pr_2025.2.19.1
1 parent e088ab2 commit f93cbb7

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

en/components/menus/toolbar.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,12 @@ Save to Image Action
153153

154154
When adding tools manually, icons can be assigned using the `RenderIconFromText` method. There are three paramters to pass in this method. The first is the icon collection name defined on the tool eg. [`iconCollectionName`]({environment:dvApiBaseUrl}/products/ignite-ui-angular/api/docs/typescript/latest/classes/igniteui_angular_layouts.igxtoolactioncomponent.html#iconCollectionName). The second is the name of the icon defined on the tool eg. [`iconName`]({environment:dvApiBaseUrl}/products/ignite-ui-angular/api/docs/typescript/latest/classes/igniteui_angular_layouts.igxtoolactioncomponent.html#iconName), followed by adding the SVG string.
155155

156+
### Data URL Icons
157+
158+
Similarly to adding svg, you can also add an Icon image from a URL via the `RegisterIconFromDataURL`. The method's third parameter would be used to enter a string URL.
159+
160+
The following snippet shows both methods of adding an Icon.
161+
156162
```html
157163
<igx-tool-action-label
158164
title="Custom Icon"
@@ -170,15 +176,61 @@ public toolbarCustomIconOnViewInit(): void {
170176
}
171177
```
172178

179+
```ts
180+
public toolbarCustomIconOnViewInit(): void {
181+
182+
toolbar.registerIconFromDataURL("CustomCollection", "CustomIcon", "https://www.svgrepo.com/show/678/calculator.svg");
183+
184+
}
185+
```
186+
173187
```ts
174188
public toolbarCustomIconOnViewInit(): void {
175189

176190
const icon = '<svg width="28px" height="28px" stroke="none" viewBox="0 0 3.5 3.5" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--gis" preserveAspectRatio="xMidYMid meet"><path d="M0.436 0.178a0.073 0.073 0 0 0 -0.062 0.036L0.01 0.846a0.073 0.073 0 0 0 0.063 0.109h0.729a0.073 0.073 0 0 0 0.063 -0.109L0.501 0.214a0.073 0.073 0 0 0 -0.064 -0.036zm0.001 0.219 0.238 0.413H0.199zM1.4 0.507v0.245h0.525v-0.245zm0.77 0v0.245h1.33v-0.245zM0.073 1.388A0.073 0.073 0 0 0 0 1.461v0.583a0.073 0.073 0 0 0 0.073 0.073h0.729A0.073 0.073 0 0 0 0.875 2.045V1.461a0.073 0.073 0 0 0 -0.073 -0.073zm0.073 0.146h0.583v0.438H0.146zM1.4 1.674v0.245h0.945v-0.245zm1.19 0v0.245h0.91v-0.245zM0.438 2.447c-0.241 0 -0.438 0.197 -0.438 0.438 0 0.241 0.197 0.438 0.438 0.438s0.438 -0.197 0.438 -0.438c0 -0.241 -0.197 -0.438 -0.438 -0.438zm0 0.146a0.291 0.291 0 0 1 0.292 0.292 0.291 0.291 0 0 1 -0.292 0.292 0.291 0.291 0 0 1 -0.292 -0.292A0.291 0.291 0 0 1 0.438 2.593zM1.4 2.842v0.245h0.525v-0.245zm0.77 0v0.245h1.33v-0.245z" fill="#000000" fill-rule="evenodd"/></svg>';
177191

178192
this.toolbar.registerIconFromText("CustomCollection", "CustomIcon", icon);
193+
194+
}
195+
```
196+
197+
```ts
198+
public toolbarCustomIconOnViewInit(): void {
199+
200+
toolbar.registerIconFromDataURL("CustomCollection", "CustomIcon", "https://www.svgrepo.com/show/678/calculator.svg");
201+
179202
}
180203
```
181204

205+
@code {
206+
207+
protected override async Task OnAfterRenderAsync(bool firstRender)
208+
{
209+
var toolbar = this.toolbar;
210+
211+
if (firstRender) {
212+
this.ToolbarCustomIconOnViewInit();
213+
}
214+
}
215+
216+
private IgbToolbar toolbar;
217+
218+
public void ToolbarCustomIconOnViewInit()
219+
{
220+
this.toolbar.EnsureReady().ContinueWith(new Action<Task>((e) =>
221+
{
222+
this.toolbar.RegisterIconFromDataURLAsync("CustomCollection", "CustomIcon", "https://www.svgrepo.com/show/678/calculator.svg");
223+
}));
224+
}
225+
226+
}
227+
228+
````
229+
230+
```tsx
231+
<IgrToolbar orientation="Vertical" />
232+
````
233+
182234
### Vertical Orientation
183235

184236
By default the Angular Toolbar is shown horizontally, but it also has the ability to shown vertically by setting the [`orientation`]({environment:dvApiBaseUrl}/products/ignite-ui-angular/api/docs/typescript/latest/classes/igniteui_angular_layouts.igxtoolbarcomponent.html#orientation) property.

0 commit comments

Comments
 (0)