Skip to content

Commit f9160ff

Browse files
svdimitrjivanova
authored andcommitted
docs(icons): next chunk
1 parent dd6a7bb commit f9160ff

File tree

14 files changed

+236
-419
lines changed

14 files changed

+236
-419
lines changed

components/button/icons.md

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,43 +8,17 @@ published: True
88
position: 2
99
---
1010

11-
1211
# Button Icons
1312

14-
You can put an image, sprite or a font icon in the button to illustrate its purpose for your end users. To apply them, use the following properties:
15-
16-
* for a font icon, use the `Icon` attribute to set the font icon class.
17-
* for an image, use the `ImageUrl` attribute to provide the URL
18-
* for a sprite, set the `SpriteClass` attribute to `k-icon MySpriteClass` where `MySpriteClass` defines the CSS rules for the sprite.
19-
20-
You can see how to use the built-in icons in the [Font Icons]({%slug general-information/font-icons%}) article.
21-
22-
For a custom font icon, define the font and glyph in your `Icon` CSS class.
23-
24-
The following example shows how to use an image from a URL, a sprite image, and the built-in font icons.
13+
You can add a [Telerik Font or SVG icon]({%slug general-information/font-icons%}) to the Button to illustrate its purpose by using the `Icon` parameter.
2514

2615
>caption How to use icons in Telerik Button
2716
2817
````CSHTML
29-
<TelerikButton SpriteClass="k-icon netherlandsFlag">Sprite</TelerikButton>
30-
<TelerikButton Icon="filter">Font Icon</TelerikButton>
31-
<TelerikButton ImageUrl="https://docs.telerik.com/blazor-ui/images/snowboarding.png">Image URL</TelerikButton>
32-
33-
<style>
34-
/* the sprite for the first button is defined through a CSS rule matchin its Class */
35-
.netherlandsFlag {
36-
background-image: url("https://docs.telerik.com/blazor-ui/images/flags.png");
37-
background-position: 0 -64px;
38-
}
39-
</style>
18+
<TelerikButton Icon="@FontIcon.Filter">Font Icon</TelerikButton>
19+
<TelerikButton Icon="@SvgIcon.Export">SVG Icon</TelerikButton>
4020
````
4121

42-
>caption The result from the code snippet above
43-
44-
![Blazor Icon Buttons](images/icon-buttons.png)
45-
46-
>tip You can use relative paths to your images in the `wwwroot` folder. The example above uses absolute paths to make it easy for you to see the results without preparing images.
47-
4822
>tip If you don't add text to the button, the button will center the icon on all sides.
4923
5024
>note Images used as icons should generally be small enough to fit in a line of text - the button is an inline element and is not designed for large images. If you want to use big icon buttons, consider one of the following options:

components/buttongroup/icons.md

Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,7 @@ position: 15
1111

1212
# ButtonGroup Icons
1313

14-
You can put an image, sprite or a font icon in the buttons within a ButtonGroup to illustrate its purpose for your end users. To apply them, use the following properties:
15-
16-
* for a [Telerik font icon]({%slug general-information/font-icons%}), use the `Icon` attribute to set the font icon class.
17-
18-
* for a raster image, use the `ImageUrl` attribute to provide the URL to the icon (relative or absolute).
19-
20-
* for a custom font icon class, set the `IconClass` parameter of the component to the desired CSS class list which provides the required rules (like font name and glyph symbol). Make sure to also reference the desired font in your app and to use its own recommendations.
21-
22-
* for a sprite, set the `SpriteClass` attribute to `k-icon MySpriteClass` where `MySpriteClass` defines the CSS rules for the sprite.
23-
24-
25-
The following example shows how to use an image from a URL, a sprite image, and the built-in font icons.
14+
You can add a [Telerik Font or SVG icon]({%slug general-information/font-icons%}) to the ButtonGroup items to illustrate its purpose by using the `Icon` parameter.
2615

2716
>caption How to use icons in the Telerik ButtonGroup Button
2817
@@ -31,43 +20,14 @@ The following example shows how to use an image from a URL, a sprite image, and
3120
It also shows how to use telerik icons, raster icons and sprite images*@
3221
3322
<TelerikButtonGroup SelectionMode="@ButtonGroupSelectionMode.Multiple">
34-
<ButtonGroupToggleButton SpriteClass="@( FlagSelected ? "flag netherlands" : "flag brazil")" @bind-Selected="@FlagSelected">Sprite</ButtonGroupToggleButton>
35-
36-
<ButtonGroupToggleButton Icon="@( FontSelected ? "volume-off" : "volume-up" )" @bind-Selected="@FontSelected">Font Icon</ButtonGroupToggleButton>
37-
38-
<ButtonGroupToggleButton ImageUrl="@RasterIconUrl" @bind-Selected="@RasterSelected">Image URL</ButtonGroupToggleButton>
23+
<ButtonGroupToggleButton Icon="@( FontSelected ? FontIcon.VolumeUp : SvgIcon.VolumeDown )" @bind-Selected="@FontSelected">Font Icon</ButtonGroupToggleButton>
3924
</TelerikButtonGroup>
4025
41-
<style>
42-
/* the sprite for the first button is defined through a CSS rule matchin its Class */
43-
.flag {
44-
background-image: url("https://docs.telerik.com/blazor-ui/images/flags.png");
45-
}
46-
47-
.flag.netherlands {
48-
background-position: 0 -64px;
49-
background-color: white;
50-
}
51-
52-
.flag.brazil {
53-
background-position: 0 0;
54-
}
55-
</style>
56-
5726
@code{
58-
bool FlagSelected { get; set; }
5927
bool FontSelected { get; set; }
60-
bool RasterSelected { get; set; }
61-
string RasterIconUrl => RasterSelected ? "https://docs.telerik.com/blazor-ui/images/snowboarding.png" : "https://docs.telerik.com/blazor-ui/images/swimming.png";
6228
}
6329
````
6430

65-
>caption The result from the code snippet above
66-
67-
![Icons in ButtonGroup Buttons](images/buttongroup-icons.png)
68-
69-
>tip You can use relative paths to your images in the `wwwroot` folder. The example above uses absolute paths to make it easy for you to see the results without preparing images.
70-
7131
>tip If you don't add text to the button, the button will center the icon on all sides.
7232
7333
>note Images used as icons should generally be small enough to fit in a line of text - the button is an inline element and is not designed for large images. If you want to use big icon buttons, consider one of the following options:

components/contextmenu/data-binding/overview.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ The menu items provide the following features that you control through the corre
3838

3939
* `Text` - the text that will be shown on the item.
4040

41-
* `Icon` - The [Telerik Font or SVG icon]({%slug general-information/font-icons%}) that will be rendered in the item. Read more in the [Icons article]({%slug breadcrumb-icons%}).
41+
* `Icon` - The [Telerik Font or SVG icon]({%slug general-information/font-icons%}) that will be rendered in the item. Read more in the [Icons article]({%slug contextmenu-icons%}).
4242

4343
* `Url` - the view the item will navigate to by generating a link.
4444

@@ -53,9 +53,7 @@ The properties of a menu item match directly to a field of the model the menu is
5353
* IdField => Id
5454
* ParentIdField => ParentId
5555
* TextField => Text
56-
* IconClassField => IconClass
5756
* IconField => Icon
58-
* ImageUrlField => ImageUrl
5957
* UrlField => Url
6058
* HasChildrenField => HasChildren
6159
* ItemsField => Items
@@ -75,7 +73,7 @@ public class ContextMenuItem
7573
public string Text { get; set; }
7674
public int? ParentId { get; set; }
7775
public bool HasChildren { get; set; }
78-
public string Icon { get; set; }
76+
public FontIcon? Icon { get; set; }
7977
public string Url { get; set; }
8078
public bool Disabled { get; set; }
8179
public bool Separator { get; set; }

components/contextmenu/refresh-data.md

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@ In this article:
4141
4242
<TelerikContextMenu Data="@MenuData"
4343
Selector="#context-menu-target"
44-
IconField="@nameof(MenuModel.TelerikIcon)"
45-
ImageUrlField="@nameof(MenuModel.MyImage)"
46-
IconClassField="@nameof(MenuModel.MyIconClass)">
44+
IconField="@nameof(MenuModel.TelerikFontIcon)">
4745
</TelerikContextMenu>
4846
4947
@code {
@@ -53,10 +51,10 @@ In this article:
5351
{
5452
MenuData.Add(
5553
new MenuModel()
56-
{
57-
Text = "Info",
58-
TelerikIcon = "info-circle"
59-
});
54+
{
55+
Text = "Info",
56+
TelerikFontIcon = FontIcon.InfoCircle
57+
});
6058
MenuData = new List<MenuModel>(MenuData);
6159
}
6260
@@ -76,12 +74,12 @@ In this article:
7674
new MenuModel()
7775
{
7876
Text = "Copy",
79-
TelerikIcon = "copy"
77+
TelerikFontIcon = FontIcon.Copy
8078
},
8179
new MenuModel()
8280
{
8381
Text = "Cut",
84-
TelerikIcon = "cut"
82+
TelerikFontIcon = FontIcon.Cut
8583
}
8684
};
8785
MenuData = new List<MenuModel>(MenuData);
@@ -94,27 +92,25 @@ In this article:
9492
new MenuModel()
9593
{
9694
Text = "IconField",
97-
TelerikIcon = "email"
95+
TelerikFontIcon = FontIcon.Envelop
9896
},
9997
new MenuModel()
10098
{
101-
Text = "IconClassField",
102-
MyIconClass = "oi oi-wrench",
99+
Text = "Wrench Icon,
100+
TelerikFontIcon = FontIcon.Wrench,
103101
},
104102
new MenuModel()
105103
{
106-
Text = "ImageUrlField",
107-
MyImage = "https://docs.telerik.com/blazor-ui/images/video.png"
104+
Text = "File Video Icon",
105+
TelerikFontIcon = FontIcon.FileVideo
108106
}
109107
};
110108
}
111109
112110
public class MenuModel
113111
{
114112
public string Text { get; set; }
115-
public string TelerikIcon { get; set; }
116-
public string MyImage { get; set; }
117-
public string MyIconClass { get; set; }
113+
public FontIcon? TelerikFontIcon { get; set; }
118114
}
119115
}
120116
````

components/gridlayout/items.md

Lines changed: 35 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ You can use the exposed parameters of the GridLayout items to create more comple
259259
<GridLayoutItems>
260260
<GridLayoutItem Column="1" Row="1" ColumnSpan="3">
261261
<span>
262-
<TelerikButton OnClick="@(() => DrawerRef.ToggleAsync())" Icon="menu">Toggle drawer</TelerikButton>
262+
<TelerikButton OnClick="@(() => DrawerRef.ToggleAsync())" Icon="@("menu")">Toggle drawer</TelerikButton>
263263
</span>
264264
</GridLayoutItem>
265265
<GridLayoutItem Column="1" Row="2">
@@ -269,6 +269,7 @@ You can use the exposed parameters of the GridLayout items to create more comple
269269
MiniMode="true"
270270
Mode="DrawerMode.Push"
271271
@ref="@DrawerRef"
272+
IconField="@nameof(DrawerItem.TelerikFontIcon)"
272273
@bind-SelectedItem="@SelectedItem">
273274
</TelerikDrawer>
274275
</div>
@@ -292,9 +293,7 @@ You can use the exposed parameters of the GridLayout items to create more comple
292293
<GridLayoutItem Column="3" Row="2">
293294
<TelerikTreeView Data="@TreeViewData">
294295
<TreeViewBindings>
295-
<TreeViewBinding IconClassField="@nameof(TreeViewModel.MyIconClass)"
296-
ImageUrlField="@nameof(TreeViewModel.MyImageUrl)"
297-
IconField="@nameof(TreeViewModel.TelerikIcon)" />
296+
<TreeViewBinding IconField="@nameof(TreeViewModel.TelerikFontIcon)" />
298297
</TreeViewBindings>
299298
</TelerikTreeView>
300299
</GridLayoutItem>
@@ -320,30 +319,30 @@ You can use the exposed parameters of the GridLayout items to create more comple
320319
TreeViewData = new List<TreeViewModel>();
321320
322321
TreeViewData.Add(new TreeViewModel()
323-
{
324-
Id = 1,
325-
Text = "Company",
326-
ParentId = null,
327-
HasChildren = true,
328-
TelerikIcon = "home"
329-
});
322+
{
323+
Id = 1,
324+
Text = "Company",
325+
ParentId = null,
326+
HasChildren = true,
327+
TelerikFontIcon = FontIcon.Home
328+
});
330329
331330
TreeViewData.Add(new TreeViewModel()
332-
{
333-
Id = 2,
334-
Text = "Contact us",
335-
ParentId = 1,
336-
HasChildren = false,
337-
MyIconClass = "oi oi-envelope-closed"
338-
});
331+
{
332+
Id = 2,
333+
Text = "Contact us",
334+
ParentId = 1,
335+
HasChildren = false,
336+
TelerikFontIcon = FontIcon.Envelop
337+
});
339338
340339
TreeViewData.Add(new TreeViewModel()
341-
{
342-
Id = 3,
343-
Text = "Audio",
344-
ParentId = null,
345-
MyImageUrl = "https://docs.telerik.com/blazor-ui/images/speaker.png"
346-
});
340+
{
341+
Id = 3,
342+
Text = "Audio",
343+
ParentId = null,
344+
TelerikFontIcon = FontIcon.FileAudio
345+
});
347346
}
348347
349348
public class TreeViewModel
@@ -352,18 +351,16 @@ You can use the exposed parameters of the GridLayout items to create more comple
352351
public string Text { get; set; }
353352
public bool HasChildren { get; set; }
354353
public int? ParentId { get; set; }
355-
public string TelerikIcon { get; set; }
356-
public string MyIconClass { get; set; }
357-
public string MyImageUrl { get; set; }
354+
public FontIcon? TelerikFontIcon { get; set; }
358355
}
359356
360357
public IEnumerable<SampleData> GridData = Enumerable.Range(1, 30).Select(x => new SampleData
361-
{
362-
Id = x,
363-
Name = "name " + x,
364-
Team = "team " + x % 5,
365-
HireDate = DateTime.Now.AddDays(-x).Date
366-
});
358+
{
359+
Id = x,
360+
Name = "name " + x,
361+
Team = "team " + x % 5,
362+
HireDate = DateTime.Now.AddDays(-x).Date
363+
});
367364
368365
public class SampleData
369366
{
@@ -377,15 +374,15 @@ You can use the exposed parameters of the GridLayout items to create more comple
377374
DrawerItem SelectedItem { get; set; }
378375
IEnumerable<DrawerItem> DrawerData { get; set; } =
379376
new List<DrawerItem>
380-
{
381-
new DrawerItem { Text = "Counter", Icon = "plus"},
382-
new DrawerItem { Text = "FetchData", Icon = "grid-layout"},
383-
};
377+
{
378+
new DrawerItem { Text = "Counter", TelerikFontIcon = FontIcon.Plus },
379+
new DrawerItem { Text = "FetchData", TelerikFontIcon = FontIcon.GridLayout },
380+
};
384381
385382
public class DrawerItem
386383
{
387384
public string Text { get; set; }
388-
public string Icon { get; set; }
385+
public FontIcon TelerikFontIcon { get; set; }
389386
}
390387
}
391388
````

0 commit comments

Comments
 (0)