Skip to content

Listbox

BsListbox is a component that let users select one or more items from a displayed list.

Added in v2.0.0

Overview

BsListbox uses BsListTile component internally and mimics the HTML List Box: <select size="number"> element. This means that you can add attributes like readonly, or disabled and it will react to them to give the best experience. You can also use v-model directive to create two-way data bindings on the model-value property.

Selected value:

IMPORTANT

Do not use the model-value property when using v-model.

Multiple Selection

<bs-listbox> support multiple selection. Multiple selection mode feature can be enabled using the multiple property explicitly.

Selected values:

Using Checkbox

In multiple selection mode, the checkbox can be enabled via use-checkbox property.

No data to display.
Selected values:

Checkbox Position and Color

In multiple selection mode, the checkbox color can be changed via checkbox-color property and the position can be changed via checkbox-position property. Valid values for this property are: left (default), right. If these property is not defined, then default value will be used.

Updated in v2.2.0
No data to display.
Selected values:

Image Support

<bs-listbox> component supports displaying images or avatars. This feature can be enabled using the show-image property explicitly and use the imageField property on the configuration schema to point to the image field in the datasource. By default, the value of property imageField is set to image.

Selected value:

Image Size And Shape

The size of images can be controlled via image-size property. Sets this property to the desired numbers of pixels and the image will displayed according to this value. And use rounded-image or circle-image property to change its shape.

Selected value:

Custom List Items

<bs-listbox> list items can be organized in different ways by providing the custom template option-item slot.

No data to display.
Selected value:

CSS Variables

As CSS technology evolves, Vue MDBootstrap introduces local CSS variables on .md-listbox for better customization. And since BsListbox also uses BsListTile internally, it also uses BsListTile's CSS variables.

Updated in v2.2.0
scss
.md-listbox {
  --md-listbox-bg: var(--navigation-background);
  --md-searchbox-bg: #{color.change(colors.$black, $alpha: 0.025)};
  --md-searchbox-active-bg: #{colors.$white};
  --md-searchbox-font-size: 14px;
  --md-searchbox-text-color: currentColor;
  --md-searchbox-border-color: #{colors.$gray-500};
  --md-searchbox-focused-border-color: var(--md-field-active-indicator);
  --md-searchbox-focused-box-shadow: color-mix(in oklch, var(--md-field-active-indicator), transparent 70%);
  --md-searchbox-padding-x: #{vars.$padding-md - 0.25};
  --md-searchbox-padding-y: #{vars.$padding-sm};
}

API Reference

Released under the BSD-3-Clause License.