Selecting a value from a dropdown list of options.
The Select component is a form control best used when a selection must be made from a predefined list of options longer than a few items. Understanding the difference between similar Pluma form control components will lead to an improved user experience:
When search is enabled, the Select can also allow users to create new options when the typed input doesn't match an existing option in the list. This is best used for creating tags or custom attributes the user will manage on their own.
A create option appears when the search input doesn't exactly match an existing option.
Enable search when the list of options is long enough that scrolling impedes the user experience. Searchable Selects add a text input inside the dropdown for filtering. Use the search for lists longer than 10 items. Additionally, be sure to enable infinite scrolling (virtualization) as it will prevent performance issues for large lists.
Individual options can be disabled to indicate they exist but aren't available in the current context. Add a description to a disabled option to explain why it's disabled so users understand what action would make them selectable.
While not explicitly required, we highly recommend providing a visible label so users understand the purpose of the Select at a glance. If visible labels aren't possible or needed, be sure to provide an accessible label.
For more information on placeholders and accessibility, see Placeholders under the Accessibility tab.
The default Select allows one selection from a list of options.
Multi-select enables one or more options to be selected from a list. Selected values are displayed as removable tags. Tags can optionally wrap to additional lines.
Search allows users to filter options by typing keywords. If enabled, user may also create new options.
In adhering with Pluma's focus on flexibility, the Select component includes customization options beyond plain text. Customization is useful for adding more descriptive option content such as status or metadata or used for highly-specialized applications or layouts.
The following parts of the Select may be customized:
Descriptions are assistive text that display below the Select field. They can accept rich content including links.
A description with an inline link directs users to additional resources.
Error messages are assistive text that display below the field. They accept rich content, allowing you to include links or formatted text that better help users resolve the issue.
An error message with a link directs users to relevant documentation or support.
A header or footer can be added to the dropdown menu for supplementary actions or context. The header appears below the search field and above the option list while the footer appears below the option list.
The header and footer provide supplementary context within the Select's dropdown.
The Select accepts a custom icon component that replaces the default icon area for options. This is useful when the entire option doesn't need to be customized. Avatars, status indicators, or external icons may be used.
A custom icon component renders user avatars in place of the default icon.
The label accepts rich content, allowing you to include supplementary elements such as badges or status indicators alongside the label text.
Icons can be used to reinforce the label's meaning.
Supplementary text clarifies that the field is not required.
Options can be customized to show additional metadata, icons, or status indicators.
Options display extra metadata like a status indicator or other metadata.
The trigger display can be customized to show a simplified version of the selected value. This is useful when the menu options are content-rich but the trigger should remain compact.
The menu shows full detail for each option while the trigger displays a compact summary.
Select options may have an additional icon and/or description to further help users differentiate between choices at a glance.
Add descriptions when labels alone don't fully convey the purpose of each option. Avoid adding icons or descriptions purely for decoration.
Use icons to provide visual context to the option, such as representing categories or user avatars.
Icons help create visual distinction between options.
Descriptions can be added to further describe the option in detail. Keep option descriptions concise.
Descriptions add detail to further describe the option.
Medium is the default size for most use cases.
Small is suitable for less prominent lists and more compact layouts and viewports.
The base Select uses base form control styles when no user interaction is detected.
On mouse hover, border styles update to hover styles.
On keyboard focus, the trigger receives the standard 2px focus ring.
Border styles update when the field is interacted with or the Select's dropdown menu is open.
Disabled Selects cannot be interacted with. Field and text color update to disabled styling.
A spinner icon indicates that options are being loaded into the list.
The Select adopts danger styling to indicate there's an error. Error text displays below the field.
A clear button can be enabled to reset the field to its empty state after a selection is made.
Clearable fields are used for optional Selects.
Use grouping to organize longer lists into more digestible categories. Avoid grouping for lists that are short enough to digest without explicit categories.
Use groups to categorize options in longer lists.
Collapsible groups let users expand and collapse sections to focus on relevant options.
When enabled, options can display tooltips on hover or focus as another method of providing more detail for that option. This may be helpful for use cases where inline option descriptions are unwanted.
Tooltips surface additional detail for options that need more explanation than the label provides.
Assistive text displays below the Select field and gives the user information about the form field they're interacting with. Assistive text comes in different forms including descriptions and error text.
Use description text to provide hints, formatting guidance, or constraints that help users make the right selection. Use complete, but short sentences for description text.
Error messages communicate issues with the Select that the user must fix before submission. Frame validation errors as direct instructions, not accusations. Be sure to provide guidance on how to fix the error. Keep messages direct and concise. Never use "Please".
Write clear, concise labels that describe the data the Select represents. Nouns and noun phrases are preferred.
Option labels should only be a few words at most. If more context is needed, a description or tooltip can be added.
Placeholders help the user complete a field by describing what information it expects or how it should be formatted. For the Select, we recommend short phrases such as "Select a [noun]" or "Search [noun]" when search is enabled. When using examples, start with e.g.