Icon

in namespace DotVVM.Bootstrap5.Controls

Usage & Scenarios

Renders a Bootstrap Icon.

https://icons.getbootstrap.com/

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
property icon Type Icons Gets or sets the used icon.
attribute
inner element
static value
bindable
default
null
property icon Visible Boolean Gets or sets whether the control is visible. When set to false, `style="display: none"` will be added to this control.
attribute
inner element
static value
bindable
default
True

HTML produced by the control