ListGroupButton

in namespace DotVVM.Bootstrap5.Controls

Represents an button item in the ListGroup control.

Usage & Scenarios

Represents a button item in ListGroup.

This control shares some properties with ListGroupLinkItem and ListGroupTextItem, but has some additional ones.

https://getbootstrap.com/docs/5.2/components/list-group/#links-and-buttons

Sample 1: ListGroupButtonItem static items

When using static ListGroupButtonItem controls, ItemType property of a parent ListGroup control shall be set to Button. Visit ListGroup to see some examples with the DataSource property.

<bs:ListGroup ItemType="Button">
    <bs:ListGroupButton Text="{value: Text}" />
    <bs:ListGroupButton Text="Item 2" Click="{command: ChangeListGroup()}" />
    <bs:ListGroupButton Text="Item 2" Enabled="{value: Enabled}" />
    <bs:ListGroupButton Text="Item 2" Selected="{value: IsSelected}" />
</bs:ListGroup>
public class ViewModel : DotvvmViewModelBase
{
    public string Text { get; set; } = "Data-bound text of the item.";
    public bool Enabled { get; set; }
    public bool IsSelected { get; set; }
    public void ChangeListGroup()
    {
        Enabled = !Enabled;
        IsSelected = !IsSelected;
        Text = "Changed";
    }

}

Properties

Name Type Description Notes Default Value
property icon BadgeTemplate ITemplate Gets or sets a custom template for a Badge control inside a ListGroupItem.
attribute
inner element
static value
bindable
default
null
property icon BadgeText String Gets or sets a plain text for a Badge control inside a ListGroupItem.
attribute
inner element
static value
bindable
default
null
property icon BadgeType BadgeColor Gets or sets a badge color.
attribute
inner element
static value
bindable
default
Primary
property icon BadgeVisualStyle BadgeVisualStyle Gets or sets a badge visual style. Possible values are `Default` Badge control or `Pill`.
attribute
inner element
static value
bindable
default
Default
property icon Color ListGroupItemColor Gets or sets a ListGroupItem color.
attribute
inner element
static value
bindable
default
Default
property icon Enabled Boolean Gets or sets a ListGroupItem's disabled state.
attribute
inner element
static value
bindable
default
True
property icon IsJustified Boolean When DataSource is set, adds `justify-content-between` and `align-items-center` CSS classes.
attribute
inner element
static value
bindable
default
False
property icon Selected Boolean Gets or sets if ListGroupItem control is selected.
attribute
inner element
static value
bindable
default
null
property icon Template ITemplate Gets or sets a custom template for a ListGroupItem control.
attribute
inner element
static value
bindable
default
null
property icon Text String Gets or sets a plain text for a ListGroupItem control.
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

Events

Name Type Description
event icon Click ICommandBinding Gets or sets the command that will be triggered when a `Button` ListGroupItem is clicked.

HTML produced by the control