Command design basics for UWP apps
In a Universal Windows Platform (UWP) app, command elements are interactive UI elements that enable users to perform actions, such as sending an email, deleting an item, or submitting a form. This article describes common command elements, the interactions they support, and the command surfaces for hosting them.
Provide the right type of interactions
When designing a command interface, the most important decision is choosing what users should be able to do. To plan the right type of interactions, focus on your app - consider the user experiences you want to enable, and what steps users will need to take. Once you decide what you want users to accomplish, then you can provide them the tools to do so.
Some interactions you might want to provide your app include:
- Sending or submiting information
- Selecting settings and choices
- Searching and filtering content
- Opening, saving, and deleting files
- Editing or creating content
Use the right command element for the interaction
Using the right elements to enable command interactions can make the difference between an intuitive, easy-to-use app and a difficult, confusing app. The Universal Windows Platform (UWP) provides a large set of command elements that you can use in your app. Here's a list of some of the most common controls and a summary of the interactions they can enable.
Buttons trigger an immediate action. Examples include sending an email, submitting form data, or confirming an action in a dialog.
Lists present items in a interactive list or a grid. Usually used for many options or display items. Examples include drop-down list, list box, list view and grid view.
Calendar, date and time pickers
Calendar, date and time pickers enable users to view and modify date and time info, such as when creating an event or setting an alarm. Examples include calendar date picker, calendar view, date picker, time picker.
Predictive text entry
Provides suggestions as users type, such as when entering data or performing queries. Examples include auto-suggest box.
For a complete list, see Controls and UI elements
Place commands on the right surface
You can place command elements on a number of surfaces in your app, including the app canvas or special command containers, such as a command bar, command bar flyout, menu bar, and dialog.
Note that, whenever possible, you should let users manipulate content directly rather than use commands that act on the content. For example, allow users to rearrange lists by dragging and dropping list items, rather than using up and down command buttons.
Otherwise, if users can't manipulate content directly, then place command elements on a command surface in your app. Here's a list of some of the most common command surfaces.
App canvas (content area)
If a command is constantly needed for users to complete core scenarios, put it on the canvas. Because you can put commands near (or on) the objects they affect, putting commands on the canvas makes them easy and obvious to use. However, choose the commands you put on the canvas carefully. Too many commands on the app canvas take up valuable screen space and can overwhelm the user. If the command won't be frequently used, consider putting it in another command surface.
Command bars and menu bars
Command bars help organize commands and make them easy to access. Command bars can be placed at the top of the screen, at the bottom of the screen, or at both the top and bottom of the screen (a MenuBar can also be used when the functionality in your app is too complex for a command bar).
Menus and context menus
Menus and context menus save space by organizing commands and hiding them until the user needs them. Users typically access a menu or context menu by clicking a button or right-clicking a control.
The command bar flyout is a type of contextual menu that combines the benefits of a command bar and a context menu into a single control. It can provide shortcuts to commonly-used actions and provide access to secondary commands that are only relevant in certain contexts, such as clipboard or custom commands.
UWP also provides a set of traditional menus and context menus; for more info, see the menus and context menus overview.
Provide feedback for interactions
Feedback communicates the results of commands and allows users to understand what they've done, and what they can do next. Ideally, feedback should be integrated naturally in your UI, so users don't have to be interrupted, or take additional action unless absolutely necessary.
Here are some ways to provide feedback in your app.
The content area of the command bar is an intuitive place to communicate status to users if they'd like to see feedback.
Flyouts are lightweight contextual popups that can be dismissed by tapping or clicking somewhere outside the flyout.
Dialog controls are modal UI overlays that provide contextual app information. In most cases, dialogs block interactions with the app window until being explicitly dismissed, and often request some kind of action from the user. Dialogs can be disruptive and should only be used in certain situations. For more info, see the When to confirm or undo actions section.
Be careful of how much your app uses confirmation dialogs; they can be very helpful when the user makes a mistake, but they are a hindrance whenever the user is trying to perform an action intentionally.
When to confirm or undo actions
No matter how well-designed the user interface is and no matter how careful the user is, at some point, all users will perform an action they wish they hadn't. Your app can help in these situations by requiring the user to confirm an action, or by providing a way of undoing recent actions.
For actions that can't be undone and have major consequences, we recommend using a confirmation dialog. Examples of such actions include:
- Overwriting a file
- Not saving a file before closing
- Confirming permanent deletion of a file or data
- Making a purchase (unless the user opts out of requiring a confirmation)
- Submitting a form, such as signing up for something
For actions that can be undone, offering a simple undo command is usually enough. Examples of such actions include:
- Deleting a file
- Deleting an email (not permanently)
- Modifying content or editing text
- Renaming a file
Optimize for specific input types
See the Interaction primer for more detail on optimizing user experiences around a specific input type or device.