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 selecting multiple values.

Java

  1. // Create the selection component
  2. ListSelect<String> select = new ListSelect<>("The List");
  3. // Add some items
  4. select.setItems("Mercury", "Venus", "Earth", ...);
  5. // Show 5 items and a scrollbar if there are more
  6. select.setRows(5);
  7. select.addValueChangeListener(event -> {
  8. Set<String> selected = event.getNewSelection();
  9. Notification.show(selected.size() + " items.");
  10. });

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

CSS

  1. .v-select {}
  2. .v-select-select {}
  3. 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.