Components
Combo box
Use with caution: Candidate English, SpanishExamples
Default
View va-combo-box default in Storybook
With Default Value
View va-combo-box with default value in Storybook
With Error
View va-combo-box with error in Storybook
Required
View va-combo-box required in Storybook
With Placeholder Text
View va-combo-box with placeholder text in Storybook
With Hint Text
View va-combo-box with hint text in Storybook
With Message Aria Described By
View uswds-va-combo-box with message aria described by in Storybook
Usage
Refer to the U.S. Web Design System for usage guidance
Choosing the right component for the task
Consider how many options the user will have when choosing the right component. The number of options will determine what component is right for the task.
- 2 - 5: Radio Buttons. Use radio buttons when there are only a few options that can all be exposed at once.
- 6 - 15: Select. Use a select for a limited number of options.
- 16 - 100: Combo Box. For over 15 items, use a combo box that combines a select with typeahead.
- 101 - ∞: Search Input typeahead. Over 100 items, use the search input component with typeahead.
Some exceptions when choosing the right component
Some exceptions can be considered when choosing the right component.
- When the options are known and memorable. Use the combo box when the user will know what to expect as options in the dropdown. Some examples of this would be a list of countries or states. See the USWDS address pattern for an example.
- When the radio button labels are long or radio tiles contain descriptive text. Using long labels within a dropdown might create an issue where the information needed to make a selection is lost. There’s also descriptive text added within radio tiles that can’t be used in a dropdown. In those use cases a radio button might be required instead of a dropdown opton.
These are some things to consider when choosing between different components. Contact the Design System team for help if you have other use cases that are considered exceptions.
Errors
- Refer to the specific error example above.
View form error handling for additional guidance
Hint text
- Refer to the hint text example above.
View label hint text for additional guidance
Code usage
Attributes and Properties
Property | Attribute | Type | Default | Description |
---|---|---|---|---|
disabled |
disabled |
boolean |
false |
The combo box component will be disabled / read-only. |
error |
error |
string |
Error message to display. When defined, this indicates an error. | |
hint |
hint |
string |
Optional hint text. | |
label |
label |
string |
Text label for the field. | |
messageAriaDescribedby |
message-aria-describedby |
string |
An optional message that will be read by screen readers when the select is focused. | |
name |
name |
string |
Name attribute for the select field. | |
placeholder |
placeholder |
string |
The placeholder string. | |
required |
required |
boolean |
false |
Whether or not this is a required field. |
value |
value |
string |
Selected value (will get updated on select). |
Events
Name | Description |
---|---|
vaSelect |
The event emitted when the selected value changes |
Accessibility considerations
Refer to the U.S. Web Design System for accessibility guidance
Related
Component checklist
Maturity
- Guidance
- Examples, usage, code usage, content considerations, and accessibility considerations are all complete.
- Research
- VFS team conducted research on this component which is linked from this page.
- Stability
- Component has been in production for more than 3 months with no significant issues found.
- Adoption
- Multiple teams have adopted this component.
Accessibility
While this component has been previously tested against older criteria, it has not yet been audited with the updated testing criteria.
Code assets
- Variations
- Storybook includes all variations (style, size, orientation, optional iconography, selection, error state, etc.)
- Responsive
- Component depicted in all responsive breakpoints.
- Interactive states
- Includes all interactive states that are applicable (hover, active, focus, keyboard focus, disabled).
- Tokens
- All design attributes (color, typography, layout, etc.) are available as tokens.
- Internationalization
- Describes i18n attributes.
Visual assets
- Variations
- Sketch library includes all variations (style, size, orientation, optional iconography, selection, error state, etc.)
- Responsive
- Component designed to work in all responsive breakpoints.
- Interactive states
- Includes all interactive states that are applicable (hover, active, focus, keyboard focus, disabled).
- Tokens
- All design attributes (color, typography, layout, etc.) are available as tokens.