Files
antigravity-skills-reference/skills/hig-components-controls/references/combo-boxes.md

41 lines
2.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "Combo boxes | Apple Developer Documentation"
source: https://developer.apple.com/design/human-interface-guidelines/combo-boxes
# Combo boxes
A combo box combines a text field with a pull-down button in a single control.
![A stylized representation of a combo box control displaying a list of cities. The image is tinted red to subtly reflect the red in the original six-color Apple logo.](https://docs-assets.developer.apple.com/published/8f828536eb509b9cd023583ecd2f8eca/components-combobox-intro%402x.png)
People can enter a custom value into the field or click the button to choose from a list of predefined values. When people enter a custom value, its not added to the list of choices.
## [Best practices](https://developer.apple.com/design/human-interface-guidelines/combo-boxes#Best-practices)
**Populate the field with a meaningful default value from the list.** Although the field can be empty by default, its best when the default value refers to the hidden choices. The default value doesnt have to be the first item in the list.
**Use an introductory label to let people know what types of items to expect.** Generally, use title-style capitalization for labels and end them with a colon. For related guidance, see [Labels](https://developer.apple.com/design/human-interface-guidelines/labels).
**Provide relevant choices.** People appreciate the ability to enter a custom value, as well as the convenience of choosing from a list of the most likely choices.
**Make sure list items arent wider than the text field.** If an item is too wide, the text field might truncate it, which is hard for people to read.
For guidance, see [Text fields](https://developer.apple.com/design/human-interface-guidelines/text-fields) and [Pull-down buttons](https://developer.apple.com/design/human-interface-guidelines/pull-down-buttons).
## [Platform considerations](https://developer.apple.com/design/human-interface-guidelines/combo-boxes#Platform-considerations)
_Not supported in iOS, iPadOS, tvOS, visionOS, or watchOS._
## [Resources](https://developer.apple.com/design/human-interface-guidelines/combo-boxes#Resources)
#### [Related](https://developer.apple.com/design/human-interface-guidelines/combo-boxes#Related)
[Text fields](https://developer.apple.com/design/human-interface-guidelines/text-fields)
[Pull-down buttons](https://developer.apple.com/design/human-interface-guidelines/pull-down-buttons)
#### [Developer documentation](https://developer.apple.com/design/human-interface-guidelines/combo-boxes#Developer-documentation)
[`NSComboBox`](https://developer.apple.com/documentation/AppKit/NSComboBox) — AppKit