Docs

Documentation versions (currently viewingVaadin 7)

You are viewing documentation for an older Vaadin version. View latest documentation

ListSelect

Live Demo

The ListSelect component is list box that shows the selectable items in a vertical list. If the number of items exceeds the height of the component, a scrollbar is shown. The component allows both single and multiple selection modes, which you can set with setMultiSelect(). It is visually identical in both modes.

// Create the selection component
ListSelect select = new ListSelect("The List");

// Add some items (here by the item ID as the caption)
select.addItems("Mercury", "Venus", "Earth", ...);

select.setNullSelectionAllowed(false);

// Show 5 items and a scrollbar if there are more
select.setRows(5);

The number of visible items is set with setRows().

listselect basic
The ListSelect Component

Common selection component features are described in "Selection Components".

CSS Style Rules

.v-select {}
  .v-select-select {}
    option {}

The component has an overall v-select style. The native <select> element has v-select-select style. The items are represented as <option> elements.