Select panel
Select panel is a semantic dialog that allows for complex selection options within an overlay.
On this page
On this page
Overview
The select panel allows users to choose one or multiple items from one or more lists and can include search functionality to speed up the selection. It can also be enhanced with additional form controls in the footer. For instance, the select panel is ideal for assigning individuals to tasks, adding labels to issues or pull requests, or switching to specific branches in a code repository.
Anatomy
The select panel consists of three main areas:
- Header: Always includes a title and a close button. An optional search/filter field can be added for quicker item finding. Once a selection is made, a "Deselect all" button should be visually present.
- List (scrollable): Comprises action list items, supporting both single and multi-select options.
- Footer: In multi-select scenarios, it includes "Cancel" and "Apply" buttons. If additional controls (like a checkbox or button) are needed, a footer is also required for single selections.
Options
The select panel provides both simple list-based single selection and complex multi-selection options, with features like filtering and link inclusion.
List (single select)
For single-item selection, if no consequential actions follow, the panel may close immediately, indicated by a checkmark on the selected item. However, when the selection triggers significant actions or the footer has additional elements (like a checkbox), declarative buttons are necessary. In such cases, the behavior is indicated visually by radio buttons, which allows users to confirm their choices, before submitting their selection.
For a simple list of pre-defined items without filtering or extra options/actions, consider using an action menu.
List (multi-select)
Use the search feature to manage extensive lists. This approach helps to prevent potential performance issues, particularly since this component does not support virtualization.
The indeterminate selections feature is valuable for bulk actions on lists. For instance, if you have 20 selected items and some of them are tagged with different labels, an indeterminate checkbox (indicated by a horizontal line) appears for labels that are not uniformly applied to all items.
For static lists that don’t require search, the ”Select all” option at the top of the list allows for quick selection or deselection of all values.
Footer
The footer may contain links, buttons, or checkboxes for additional actions. Declarative buttons, such as "Cancel" and "Apply", are essential for multiple selections or single selections with additional elements in the footer.
Current selection
To effectively summarize the current selection, it's important to display the selected items at the beginning of the unfiltered list. However, this behavior should occur only after users clear the search input or close and reopen the select panel. It is crucial to avoid the immediate reordering of items after selection to prevent disorienting and confusing users.
Error/Warning
Error or warning messages are crucial for communicating issues like loading failures or important information to the user.
Empty state
Provide explanatory messages in cases of no results, whether due to unmatched search/filter inputs or the absence of data.
Limited selections
Inform users about any selection limitations beforehand. Upon reaching the maximum selection, display a warning message, potentially with an upgrade link for paid features. The warning message is labeled with an aria-live
attribute, ensuring that users with screen readers receive a notification when the message appears.
Loading
Loading states should be used to indicate ongoing processes at various stages, enhancing user awareness and interaction understanding.
- Initial: Used during initial data retrieval to avoid displaying an empty list.
- Initial Skeleton: Used similarly for initial data retrieval, presenting a skeleton screen instead of an empty list.
- Searching/Filtering: A minimal loading indicator is used during searches, allowing users to retain or continue their selections.
- Confirmation: Essential when updates aren't instant or when there's no error messaging for failures, using a confirmation button to indicate update progress.
Behavior
Opening
Select panels can be activated by regular buttons, icon buttos, or action menu items. Proper labeling is crucial for representing current selections, either internally (within the button) or externally (adjacent to the button). Focus will be placed on the first interactive element within the select panel.
When the select panel is activated through an action menu, it should be displayed as a centered dialog using the dialog
property.
Closing
To close the select panel, pressing 'Esc', selecting a 'Cancel' option or clicking outside will close the dialog, and return focus to the trigger element without retaining or submitting any user input. Conversely, clicking 'Submit' or pressing 'Enter' while focused in the listbox will submit the user's input.
Appearance
The select panel can appear as either an anchored or centered dialog, depending on the trigger source.
Responsive
On smaller viewports, the select panel adapts to a full-screen or bottom sheet dialog. Enhanced sizes of buttons and list items improve usability on touch devices.
See the Dialog guidelines for more details.
Usage guidelines
Predictability
Ensure clarity in the multi-selection process by using confirmatory actions. Avoid automatic updates or dialog closure upon selection.
For multi selection have the user confirm their selection.
Don't force users to submit their multi-selection by closing the dialog or auto-updating their choices upon selection.
Search/Filtering
Include a search or filter input for efficiency. Presenting a limited number of items, like frequently used labels, can optimize the selection process.
Always keep the search/filter input in the sticky header.
Don’t place the search/filter input in the scrollable area.
To enhance the performance and user experience, a smart approach involves returning a limited, chosen set of items. For example, displaying the most commonly used labels rather than the first 20 in alphabetical order can speed up the selection process and may even reduce the need for searching.
Order the items based on frequency of use.
Don’t add frequently used items in a separate group.
Distinction
Include only essential details to aid in item differentiation. Avoid unnecessary information that doesn't contribute to the selection process.
Add info that can help differentiate items from each other.
Avoid repetitive info that can be assumed from it's context. In this instance, repository icons in a list of only repositories.
Items marked with a checkmark icon, unlike those with radio buttons or checkboxes, signal that the selection panel will close automatically after a choice is made.
Use a checkmark icon to indicate that the single select panel will close when clicking an individual item.
Avoid combining declarative buttons with single select items that feature checkmark icons.
Adding a checkbox to the footer requires declarative buttons, and items should feature visual radio buttons. While not actual radio buttons semantically, this design effectively indicates that the selection process continues after a choice is made.
When adding an additional checkbox in the footer, it is necessary to use declarative buttons and ensure that the items are accompanied by radio buttons.
Avoid mixing declaritive buttons and items with checkmark icons.
Clearing
The select panel supports various data clearance methods:
- In single and multi-selection modes with a search/filter input, an x-circle-fill icon for quick clearing.
- For multi-selection with search, a 'deselect all' icon button in the header.
- In multi-selection without search, a header checkbox allows for one-click selection or deselection of all items.
Display a clear icon within the input to clear it's value.
Don't forget to display a clear icon when the input has a value.
In multi-selections with search capabilities, a deselect all icon button is accessible for easy unselection as soon as one item is selected.
When one or more items are selected, display a deselect all button in the header to deselect the entire selection.
When one or more items are selected don't forget to display a deselect all button in the header.
Keyboard interactions
Activation (Trigger)
Key | Description |
---|---|
Enter | Opens the select panel. |
Space | Opens the select panel. |
Select panel
Key | Description |
---|---|
Enter | Submits the information in the form when focused in the listbox. Activates buttons or links focused within the select panel. Does no action when focused in the search input. |
Tab | Move focus forward between interactive controls and widgets within the dialog. |
Shift + Tab | Move focus backward between interactive controls and widgets within the dialog. |
ArrowDown | Move focus from the input to the listbox. (Shift+Tab required to move from listbox to input. Navigate forward through items in the listbox. If focus is on the last item in the listbox, ArrowDown does nothing. |
ArrowUp | Navigate backward through items in the listbox. If at the first item in the listbox, ArrowUp does nothing. |
Home | Move focus to first item in listbox. |
PageUp | Move focus to first item in listbox. |
End | Move focus to last item in listbox. |
PageDown | Move focus to last item in listbox. |
Esc | Close dialog and clear any changed inputs. |
Multi-select
Key | Description |
---|---|
ArrowDown | Navigate through the listbox items. |
Space | Select an item in the listbox. |
Single-select
Key | Description |
---|---|
ArrowDown | Navigate through listbox items. Selection follows focus. |
Accessibility
For enhanced accessibility, it's important to use explicit saving mechanisms in the select panel. This includes incorporating "Apply" and "Cancel" buttons for both single- and multi-selection scenarios. These buttons provide clear, accessible actions for users to confirm or revoke their selections.
Automatic saving may be suitable for single selections that do not include additional form controls. In such cases, the selection process is straightforward and does not require further user confirmation, making it accessible and efficient. However, when the selection process involves additional steps or consequences, explicit saving mechanisms are crucial to ensure that all users, including those with accessibility needs, can confidently and accurately manage their selections.