--- parts: - Listbox - Use Cases title: 'Listbox: Use Cases' eleventyNavigation: key: 'Listbox: Use Cases' order: 20 parent: Listbox title: Use Cases --- # Listbox: Use Cases ```js script import { html } from '@mdjs/mdjs-preview'; import { listboxData } from './src/listboxData.js'; import { Required } from '@lion/ui/form-core.js'; import { loadDefaultFeedbackMessages } from '@lion/ui/validate-messages.js'; import '@lion/ui/define/lion-listbox.js'; import '@lion/ui/define/lion-option.js'; loadDefaultFeedbackMessages(); ``` ## Multiple choice Add `multiple-choice` flag to allow multiple values to be selected. This will: - keep the listbox overlay open on click of an option - display a list of selected option representations next to the text box - make the value of type `Array` instead of `String` ```html preview-story Apple Artichoke Asparagus Banana Beets Bell pepper Broccoli Brussels sprout Cabbage Carrot ``` ## Orientation When `orientation="horizontal"`, left and right arrow keys will be enabled, plus the screenreader will be informed about the direction of the options. By default, `orientation="vertical"` is set, which enables up and down arrow keys. ```html preview-story Apple Artichoke Asparagus Banana Beets Bell pepper Broccoli Brussels sprout Cabbage Carrot ``` With `multiple-choice` flag configured, multiple options can be checked. ```html preview-story Apple Artichoke Asparagus Banana Beets Bell pepper Broccoli Brussels sprout Cabbage Carrot ``` ## Selection-follows-focus When true, will synchronize activedescendant and selected element on arrow key navigation. This behavior can usually be seen in `