List Box
- Usage
- Styling
List Box allows the user to select one or more values from a scrollable list of items.
new tab
Source code
ListBoxBasic.java
list-box-basic.tsx
list-box-basic.ts
Although functionally similar to Checkbox Group and Radio Button Group, List Box is designed to be used as a lightweight scrollable selection list, rather than as a form input field.
Dividers
You can use dividers to group related items. Use them sparingly to avoid creating unnecessary visual clutter.
new tab
Source code
ListBoxSeparators.java
list-box-separators.tsx
list-box-separators.ts
Disabled Items
Disable items to show that they are currently unavailable for selection.
new tab
Source code
ListBoxDisabledItems.java
list-box-disabled-items.tsx
list-box-disabled-items.ts
Note
|
Accessibility
Some assistive technologies don’t announce disabled items. |
Selection
List Box supports both single and multiple selection. Single selection allows the user to select only one item, whereas multiple selection enables more than one item to be selected.
Single
new tab
Source code
ListBoxSingleSelection.java
list-box-single-selection.tsx
list-box-single-selection.ts
Multi
new tab
Source code
ListBoxMultiSelection.java
list-box-multi-selection.tsx
list-box-multi-selection.ts
Custom Item Presentation
Items can be rendered with rich content instead of plain text. This can be useful to provide additional information in a more legible fashion than appending it to the item text.
new tab
Source code
ListBoxCustomItemPresentation.java
list-box-custom-item-presentation.tsx
list-box-custom-item-presentation.ts
Best Practices
List Box isn’t designed to be used as an input field in forms, and lacks features such as label, helper, and validation errors. See related components later for better options for use in forms. List Box is best suited for use as a lightweight, scrollable, single-column list for single or multi-selection of items.
Related Components
Component | Usage recommendations |
---|---|
Input field for selecting multiple options from a list. | |
Select a value from a filterable overlay. Appropriate for large sets of options. Supports lazy loading and entry of custom values. | |
Select a single option from a list. Optimal accessibility, as all options are visible without any user action. | |
Input field for selecting a value from a overlay. More compact than a Radio Button Group. | |
A more advanced list component for cases where multiple columns, filtering or lazy loading is required. |
30C8BEB8-5F4C-4CF7-B292-AE67C4151CBC