DropDownItem

in namespace DotVVM.Bootstrap5.Controls

Represent a child element in dropdown

Usage & Scenarios

Represents a single item inside a dropdown menu.

https://getbootstrap.com/docs/5.2/components/dropdowns

Sample 1: Basic Usage

This child control is shared across all DropDown controls:

All properties of DropDownItem control could be binded with a Item prefix property (ItemEnabled, ItemSelected, ItemNavigateUrl, ItemRouteName...) on the parent controls above.

<bs:DropDown Text="Very Simple Dropdown">
    <bs:DropDownItem NavigateUrl="https://www.google.com/">
      Google
    </bs:DropDownItem>
    <bs:DropDownItem NavigateUrl="https://github.com/riganti/dotvvm" Text="DotVVM" />
</bs:DropDown>

<bs:DropDown ButtonType="Link" >
  <Content>
    <bs:Icon Type="Calendar" />
    <strong>Simple Dropdown</strong>
    with custom toggle
  </Content>
  <bs:DropDownItem NavigateUrl="https://www.google.com/" Enabled="false">
    Google
  </bs:DropDownItem>
  <bs:DropDownSeparator />
  <bs:DropDownItem NavigateUrl="https://github.com/riganti/dotvvm">
    DotVVM
  </bs:DropDownItem>
</bs:DropDown>

<bs:DropDown Text="Drop up Button" DropDirection="DropUp">
  <bs:DropDownItem NavigateUrl="https://www.google.com/">
      Google is a <strong>search engine</strong>
  </bs:DropDownItem>
  <bs:DropDownItem NavigateUrl="https://github.com/riganti/dotvvm">
    DotVVM
  </bs:DropDownItem>
</bs:DropDown>


<p>IsCollapsed: {{value: Collapsed}}</p>
<bs:DropDown IsCollapsed="{value: Collapsed}" Text="Collapse test">
  <bs:DropDownItem NavigateUrl="https://www.google.com">Google</bs:DropDownItem>
</bs:DropDown>
public class ViewModel : DotvvmViewModelBase
{
    public bool Collapsed { get; set; }
}

Properties

Name Type Description Notes Default Value
property icon Enabled Boolean Gets or sets whether the item in the dropdown menu should be enabled or disabled.
attribute
inner element
static value
bindable
default
True
property icon NavigateUrl String Gets or sets the URL to navigate to when an item in the dropdown menu is clicked.
attribute
inner element
static value
bindable
default
null
property icon RouteName String Gets or sets the route name to navigate to when an item in the dropdown menu is clicked.
attribute
inner element
static value
bindable
default
null
property icon Selected Boolean Gets or sets whether an item in the dropdown menu is selected.
attribute
inner element
static value
bindable
default
null
property icon Template ITemplate Gets or sets the template to use for item in the dropdown menu.
attribute
inner element
static value
bindable
default
null
property icon Text String Gets or sets the text to display item in the dropdown menu.
attribute
inner element
static value
bindable
default
null
property icon UrlSuffix String Gets or sets a suffix to append to the URL for item in the dropdown menu.
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 item in the dropdown menu are clicked.

HTML produced by the control