Selecting a value from a dropdown list of options.

Anatomy

  1. Container: Outer wrapper that houses the label, trigger, and footer elements.
  2. Label: Describes the purpose of the Select field.
  3. Trigger: Opens the dropdown menu and displays the selected value or placeholder text.
  4. Chevron: Indicates the field is expandable.

Guidelines

Choosing a form control

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:

  • Checkbox Groups are used to select one or more options from a short list.
  • Radio Groups are used for short lists where only one option may be selected and there may be a default selected option.
  • Segmented Controls include 2-3 mutually exclusive options that act as a mode switch that users will toggle frequently.
  • Text Fields are used for freeform text.

Creating new options

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.

Creating new options

A create option appears when the search input doesn't exactly match an existing option.

Handling large lists

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.

Best practices

Disabled options

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.

Do: Use a description to explain why the option is unavailable.
Don't: Disable options without explanation.

Labels and placeholders

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.

Do: Include a visible label that describes the data.
Don't: Use placeholders in place of visible labels.

Types

Single-select

The default Select allows one selection from a list of options.

Multi-select

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.

Searchable

Search allows users to filter options by typing keywords. If enabled, user may also create new options.

Customization

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:

Custom description

Descriptions are assistive text that display below the Select field. They can accept rich content including links.

Custom description with link

A description with an inline link directs users to additional resources.

Custom error

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.

Error with link

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.

Header and footer

The header and footer provide supplementary context within the Select's dropdown.

Custom icon

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.

Custom icon component

A custom icon component renders user avatars in place of the default icon.

Custom label

The label accepts rich content, allowing you to include supplementary elements such as badges or status indicators alongside the label text.

Label with icon

Icons can be used to reinforce the label's meaning.

Label with optional text

Supplementary text clarifies that the field is not required.

Custom option

Options can be customized to show additional metadata, icons, or status indicators.

Custom option

Options display extra metadata like a status indicator or other metadata.

Custom selected value

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.

Custom value

The menu shows full detail for each option while the trigger displays a compact summary.

Appearance

Option context

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.

Icons

Use icons to provide visual context to the option, such as representing categories or user avatars.

Options with icons

Icons help create visual distinction between options.

Descriptions

Descriptions can be added to further describe the option in detail. Keep option descriptions concise.

Option description

Descriptions add detail to further describe the option.

Sizes

Medium

Medium is the default size for most use cases.

Small

Small is suitable for less prominent lists and more compact layouts and viewports.

Behaviors

States

Base

The base Select uses base form control styles when no user interaction is detected.

Hover

On mouse hover, border styles update to hover styles.

Focus

On keyboard focus, the trigger receives the standard 2px focus ring.

Active

Border styles update when the field is interacted with or the Select's dropdown menu is open.

Disabled

Disabled Selects cannot be interacted with. Field and text color update to disabled styling.

Loading

A spinner icon indicates that options are being loaded into the list.

Danger

The Select adopts danger styling to indicate there's an error. Error text displays below the field.

Clear button

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.

Grouping

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.

Tooltips

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.

Option tooltips

Tooltips surface additional detail for options that need more explanation than the label provides.

Content

Assistive text

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.

Description

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.

Do: Provide context that helps the user make a selection.
Don't: Repeat label information.

Error

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".

Do: Note the specific problem and how to solve it.

Labels

Write clear, concise labels that describe the data the Select represents. Nouns and noun phrases are preferred.

Do: Use a noun that describes the data.
Don't: Use instructional phrases as the label.

Option label

Option labels should only be a few words at most. If more context is needed, a description or tooltip can be added.

Do: Keep option labels brief and use sentence case.
Don't: Write long, descriptive labels that slow scanning.

Placeholders

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.

Do: Use placeholders that name the expected selection and search target.
Don't: Use vague placeholders that provide no context.