Icon
in namespace DotVVM.Bootstrap5.Controls
Usage & Scenarios
Renders a Bootstrap Icon.
Sample 1: Basic Usage
The Icon
control has the Type
property which determines used icon.
<bs:Icon Type="check" />
Sample 2: Button with Icon
The Icon
control can be used together with the Button
controls and because Type
property is a data binding, icon can be changes after some operation is finished.
<bs:Button Click="{command: ChangeIcon(); }">
<bs:Icon Type="{value: PostbackIcon}" />
{{value: ButtonText}}
</bs:Button>
public class ViewModel : DotvvmViewModelBase
{
public Icons PostbackIcon { get; set; } = Icons.Clipboard;
public string ButtonText { get; set; } = "Copy to clipboard";
public void ChangeIcon()
{
if (PostbackIcon == Icons.Clipboard)
{
PostbackIcon = Icons.Check;
}
ButtonText = "Copied!";
}
}
Properties
Name | Type | Description | Notes | Default Value | |
---|---|---|---|---|---|
ClientIDMode | ClientIDMode | Gets or sets the client ID generation algorithm. |
attribute
static value
|
Static | |
DataContext | Object | Gets or sets a data context for the control and its children. All value and command bindings are evaluated in context of this value. The DataContext is null in client-side templates. |
attribute
bindable
|
null | |
ID | String | Gets or sets the control client ID within its naming container. |
attribute
static value
bindable
|
null | |
IncludeInPage | Boolean | Gets or sets whether the control is included in the DOM of the page. |
attribute
bindable
|
True | |
Type | Icons | Gets or sets the used icon. |
attribute
static value
bindable
|
null | |
Visible | Boolean | Gets or sets whether the control is visible. When set to false, `style="display: none"` will be added to this control. |
attribute
static value
bindable
|
True |