@swivel/ui/elements/listbox

Listbox

The ui-listbox element creates a fully accessible list of options which allows users to select one of the options. Each option in a listbox is declared using a ui-listitem element:


    <ui-listbox>
      <ui-listitem data-value="One">Item One</ui-listitem>
      <ui-listitem data-value="Two">Item Two</ui-listitem>
      <ui-listitem data-value="Three">Item Three</ui-listitem>
      <ui-listitem data-value="Four">Item Four</ui-listitem>
    </ui-listbox>
    

Similar to regular input elements, the ui-listbox element:

Similar to regular option elements, the ui-listitem element:

Plain HTML Example

This example shows a listbox using plain HTML and no data-binding or templating. The value for each item is set using the data-value attribute.

Item One Item Two Item Three Item Four
ValueChangeEvent

Component Example