Blame hig/C/buttons.page

Packit 1470ea
Packit 1470ea
      xmlns:uix="http://projectmallard.org/experimental/ui/"
Packit 1470ea
      type="topic"
Packit 1470ea
      id="buttons">
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
    <credit>
Packit 1470ea
      <name>Calum Benson</name>
Packit 1470ea
    </credit>
Packit 1470ea
    <credit>
Packit 1470ea
      <name>Adam Elman</name>
Packit 1470ea
    </credit>
Packit 1470ea
    <credit>
Packit 1470ea
      <name>Seth Nickell</name>
Packit 1470ea
    </credit>
Packit 1470ea
    <credit>
Packit 1470ea
      <name>Colin Robertson</name>
Packit 1470ea
    </credit>
Packit 1470ea
Packit 1470ea
    <link type="guide" xref="ui-elements"/>
Packit 1470ea
    <uix:thumb mime="image/svg" src="figures/ui-elements/buttons.svg"/>
Packit 1470ea
Packit 1470ea
    <include href="legal.xml" xmlns="http://www.w3.org/2001/XInclude"/>
Packit 1470ea
  </info>
Packit 1470ea
Packit 1470ea
<title>Buttons</title>
Packit 1470ea
Packit 1470ea

Buttons are one of the most common and basic user interface elements. Buttons can be used to perform actions, toggle settings or views, activate tools, or to display dialogs, popovers, or other user interface elements.

Packit 1470ea
Packit 1470ea
<media type="image" mime="image/svg" src="figures/ui-elements/buttons.svg"/>
Packit 1470ea
Packit 1470ea
<section id="general-guidelines">
Packit 1470ea
<title>General Guidelines</title>
Packit 1470ea
Packit 1470ea
<list>
Packit 1470ea
<item>

A button can contain an icon, button, or - more unusually - an image. Follow the icons and artwork guidelines when deciding which to use.

</item>
Packit 1470ea
<item>

After pressing a button, the user should expect to see the result of their action within 1 second.

</item>
Packit 1470ea
<item>

Do not use more than one or two different widths of button in the same window, and make all of them the same height. This will help give a pleasing uniform visual appearance to your window that makes it easier to use.

</item>
Packit 1470ea
<item>

Do not assign actions to double-clicking or right-clicking a button. Users are unlikely to discover these actions, and if they do, it will distort their expectations of other buttons on the desktop.

</item>
Packit 1470ea
<item>

Make invalid buttons insensitive, rather than popping up an error message when the user clicks them.

</item>
Packit 1470ea
<item>

When several buttons are placed next to each other, ensure that they have the same width. This is particularly important for pairs of Cancel and OK buttons.

</item>
Packit 1470ea
<item>

In a dialog, one button may be made the default button, which is shown with a different border and is activated by pressing Return. Often this will be the OK or equivalent button. However, if pressing this button by mistake could cause a loss of data, do not set a default button for the window.

</item>
Packit 1470ea
</list>
Packit 1470ea
Packit 1470ea
</section>
Packit 1470ea
Packit 1470ea
<section id="text-buttons">
Packit 1470ea
<title>Text buttons</title>
Packit 1470ea
Packit 1470ea
<list>
Packit 1470ea
<item>

Label all buttons with imperative verbs, using <link xref="writing-style#capitalization">header capitalization</link>. For example, <gui>Save</gui>, <gui>Sort</gui> or <gui>Update Now</gui>.

</item>
Packit 1470ea
<item>

Use <link xref="writing-style#ellipses">ellipses</link> when a button requires further input from the user to complete an action.

</item>
Packit 1470ea
<item>

Provide an <link xref="keyboard-input#access-keys">access key</link> in the label that allows the user to directly activate the button from the keyboard.

</item>
Packit 1470ea
<item>

Keep labels short, so they don't cause a button to use too much space. It is also important to consider how labels will change length when localized.

</item>
Packit 1470ea
</list>
Packit 1470ea
Packit 1470ea
</section>
Packit 1470ea
Packit 1470ea
<section id="toggle-buttons">
Packit 1470ea
<title>Toggle buttons</title>
Packit 1470ea
Packit 1470ea

Toggle buttons look the same as regular buttons, but are used to show or change a state rather than initiate an action. A toggle button’s two states, set and unset, are shown by its appearing “pushed in” or “popped out” respectively.

Packit 1470ea
Packit 1470ea
</section>
Packit 1470ea
Packit 1470ea
<section id="linked-buttons">
Packit 1470ea
<title>Linked buttons</title>
Packit 1470ea
Packit 1470ea

Groups of buttons with a similar function can be grouped. This helps to communicate their similarity. Linking is a common technique for sets of toggle buttons.

Packit 1470ea
Packit 1470ea
</section>
Packit 1470ea
Packit 1470ea
<section id="suggested-and-destructive">
Packit 1470ea
<title>Suggested and destructive actions</title>
Packit 1470ea
Packit 1470ea

In cases where a button has a particularly important affirmative role, it can be given a suggested style. This highlights the button, and helps to distinguish it from other visible controls.

Packit 1470ea
Packit 1470ea

Buttons which have a destructive consequence, such as removing or deleting a content item, can be given a destructive style. This highlights the button by coloring it, and acts as a warning to the user.

Packit 1470ea
Packit 1470ea

Each view should only include a single suggested or destructive button.

Packit 1470ea
Packit 1470ea
</section>
Packit 1470ea
Packit 1470ea
<section id="api-reference">
Packit 1470ea
<title>API reference</title>
Packit 1470ea
Packit 1470ea
<list>
Packit 1470ea
<item>

<link href="https://developer.gnome.org/gtk3/stable/GtkButton.html">GtkButton</link>

</item>
Packit 1470ea
<item>

<link href="https://developer.gnome.org/gtk3/stable/GtkToggleButton.html">GtkToggleButton</link>

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