Blame hig/C/drop-down-lists.page

Packit 1470ea
Packit 1470ea
      xmlns:uix="http://projectmallard.org/experimental/ui/"
Packit 1470ea
      type="topic"
Packit 1470ea
      id="drop-down-lists">
Packit 1470ea
Packit 1470ea
  <info>
Packit 1470ea
    <credit type="author">
Packit 1470ea
      <name>Allan Day</name>
Packit 1470ea
      <email>aday@gnome.org</email>
Packit 1470ea
    </credit>
Packit 1470ea
Packit 1470ea
    <link type="guide" xref="ui-elements"/>
Packit 1470ea
    <uix:thumb mime="image/svg" src="figures/ui-elements/drop-down-list.svg"/>
Packit 1470ea
Packit 1470ea
    <include href="legal.xml" xmlns="http://www.w3.org/2001/XInclude"/>
Packit 1470ea
  </info>
Packit 1470ea
Packit 1470ea
<title>Drop-down lists</title>
Packit 1470ea
Packit 1470ea

A drop-down list is a user interface element which allows the user to select from a list of mutually exclusive options. It appears as a button which, when clicked, reveals a list.

Packit 1470ea
Packit 1470ea
<media type="image" mime="image/svg" src="figures/ui-elements/drop-down-list.svg"/>
Packit 1470ea
Packit 1470ea

Radio buttons or a list will often be preferable to a drop-down list, as they present all the available options at once without any further interaction. At the same time, a drop-down list might be a better choice when:

Packit 1470ea
Packit 1470ea
<list>
Packit 1470ea
<item>

The number of options is large.

</item>
Packit 1470ea
<item>

There is little available space.

</item>
Packit 1470ea
<item>

The list of options may change over time.

</item>
Packit 1470ea
<item>

The contents of the hidden part of the menu are obvious from its label and the one selected item. For example, if you have an option menu labelled “Month:” with the item “January” selected, the user might reasonably infer that the menu contains the 12 months of the year without having to look.

</item>
Packit 1470ea
</list>
Packit 1470ea
Packit 1470ea
<section id="general-guidelines">
Packit 1470ea
<title>General guidelines</title>
Packit 1470ea
Packit 1470ea
<list>
Packit 1470ea
<item>

While GTK+ does provide a specific combobox widget, it is recommended that drop-down lists are constructed using a combination of a button and a popover. This allows more comfortable scrolling for long lists, and allows search to be integrated into the list. Using this approach also allows the current selected item to always be displayed.

</item>
Packit 1470ea
<item>

If the number of items is very large, provide a search function that filters the list.

</item>
Packit 1470ea
<item>

Label the drop-down list button with a text label above it or to its left, using <link xref="writing-style#capitalization">sentence capitalization</link>. Provide an access key in the label that allows the user to give focus directly to the drop-down list.

</item>
Packit 1470ea
<item>

Use <link xref="writing-style#capitalization">sentence capitalization</link> for drop-down list items, for example <gui>Switched movement</gui>.

</item>
Packit 1470ea
</list>
Packit 1470ea
Packit 1470ea
</section>
Packit 1470ea
Packit 1470ea
<section id="custom-values">
Packit 1470ea
<title>Custom values</title>
Packit 1470ea
Packit 1470ea
<media type="image" mime="image/svg" src="figures/ui-elements/drop-down-list-custom-values.svg"/>
Packit 1470ea
Packit 1470ea

A drop-down list can allow custom values to be added to a number of presets, or can be used to enter and select from custom values alone.

Packit 1470ea
Packit 1470ea
<list>
Packit 1470ea
<item>

Ensure that custom values are ordered in a way that is most useful to users. Alphabetical or recency ordering is common.

</item>
Packit 1470ea
<item>

When a drop-down list includes both preset and custom values, separate them into separate groups within the list.

</item>
Packit 1470ea
<item>

Allow custom values to be removed from the list.

</item>
Packit 1470ea
<item>

Validate custom values as they are entered, in order to prevent errors.

</item>
Packit 1470ea
<item>

If the drop-down only accepts custom values, and no values have been entered previously, present the custom value entry when the drop-down is opened, instead of showing an empty list.

</item>
Packit 1470ea
</list>
Packit 1470ea
Packit 1470ea
</section>
Packit 1470ea
Packit 1470ea
</page>