Keyboard shortcuts
The workspace runs a WindowCommand for each shortcut. workspace.RunCommand(command) runs the same commands from code.
| Command | Default keys | Action |
|---|---|---|
NextWindow |
Ctrl+Tab, Ctrl+F6 | Focus the next window in screen order: left to right, then top to bottom. Repeat to visit every window. |
PreviousWindow |
Ctrl+Shift+Tab, Ctrl+Shift+F6 | Focus the previous window in screen order. |
CloseWindow |
Ctrl+W, Ctrl+F4 | Close the focused window, or the selected tab in a group. The group title bar close button still closes the whole group. |
NextTab, PreviousTab |
Ctrl+PageDown, Ctrl+PageUp | Select the next or previous local tab. Outside a tab control, cycle windows. |
ToggleMinimize |
Ctrl+M | Minimize the focused window, or restore it. |
ToggleMaximize |
F11 | Maximize the focused window, or restore it. |
ToggleToolbarFocus |
F10 | Move keyboard focus to the first control of the WorkspaceToolbar, or from the toolbar back to the focused window. Works also while nothing has focus. |
MoveLeft, MoveRight, MoveUp, MoveDown |
Ctrl+Arrows | Move the focused window by key-step pixels. It stays in the viewport. |
ResizeNarrower, ResizeWider, ResizeShorter, ResizeTaller |
Ctrl+Shift+Arrows | Move the right or bottom edge by key-step pixels, within the minimum size of the window (min-width, min-height) and the viewport. |
WindowMode |
Ctrl+Alt+Space | Start the window mode on the focused window. See Window mode. |
Overview |
Ctrl held after Ctrl+Tab | Show every window in a grid to pick one. See Overview. |
Move and resize obey CanBeDragged and CanResize. They do nothing on a minimized, maximized or docked window. NextWindow and PreviousWindow skip a hidden window (see Minimize modes).
With the Input System package
When the com.unity.inputsystem package is installed and the active input handler includes it, the shortcuts are Input System actions:
- The workspace uses the actions in the
UIToolboxmap (Workspace.INPUT_ACTION_MAP) of itsInputActionsasset. Each action with the name of aWindowCommandruns that command. A missing action has no shortcut. - With no asset assigned, the workspace uses the default asset
Assets/UIToolbox/Runtime/Resources/UIToolbox/ToolboxInputActions.inputactions. - To change the keys, copy the default asset, edit the bindings, and assign the copy:
- UXML:
<UIToolbox.Workspace input-actions="project://database/Assets/MyShortcuts.inputactions" /> - Code:
workspace.InputActions = myAsset;
- UXML:
- The workspace enables the map and does not disable it. Other workspaces can share one asset.
- A held move or resize key repeats after 400 ms, every 50 ms.
- A binding runs only when the held modifier keys are the ones it names. Ctrl+Shift+Tab runs
PreviousWindowand not the Ctrl+Tab binding ofNextWindow. - The default asset has no Cmd bindings. Add them to your copy for macOS.
- Editor panels (EditorWindows) do not use the actions. They use the fixed keys below.
Players can rebind with the standard Input System APIs on workspace.ActiveInputActionMap:
var action =
workspace.ActiveInputActionMap!.FindAction(
nameof(WindowCommand.CloseWindow));
action.Disable();
action.PerformInteractiveRebinding(bindingIndex)
.OnComplete(op => { op.Dispose(); action.Enable(); }).Start();
// Save and load the player's keys.
PlayerPrefs.SetString("tb-keys",
workspace.ActiveInputActionMap.asset.SaveBindingOverridesAsJson());
workspace.ActiveInputActionMap.asset.LoadBindingOverridesFromJson(
PlayerPrefs.GetString("tb-keys"));
ActiveInputActionMap is null until the workspace attaches to a runtime panel, and when the asset has no UIToolbox map. With no UIToolbox map, the workspace logs a warning and uses the fixed keys.
Gamepad
The default asset also has gamepad bindings. The scheme is the same in every screen, so a player learns it once:
| Command | Gamepad |
|---|---|
NextWindow, PreviousWindow |
Right shoulder (RB), left shoulder (LB) |
Overview |
RB or LB held |
NextTab, PreviousTab |
Right trigger (RT), left trigger (LT) |
ToggleToolbarFocus |
View (select), a tap |
WindowMode |
View (select), held |
CloseWindow |
East (B), see below |
ToggleMinimize |
Right stick press |
ToggleMaximize |
North button |
| Scroll the focused window | Right stick |
- RB goes to the next window and LB to the previous one, in screen order: left to right, then top to bottom. A window that starts lower than the middle of the first window of a row starts the next row. The order follows where the windows are, not which one is on top.
- RB or LB held for 0.3 seconds opens the overview.
- In an MDI tab group or a
NavigableTabViewwithBumperSwitch, the triggers select the tabs. Past the last tab RT goes on to the next window; before the first tab LT goes to the previous window. - The D-pad and the left stick move keyboard focus to the nearest
control in that direction. They stop at the edge of the window, so a
player explores a window without leaving it by mistake. Set
dpad-crosses-windows="true"(DpadCrossesWindows) to go on past the edge to the nearest window in that direction. - A tap of View (select) goes to the toolbar and back, as F10 does. On
the toolbar it has the class
tb-workspace-toolbar--active(Workspace.TOOLBAR_ACTIVE_CLASS). B on the toolbar also goes back to the windows. View held starts the window mode. - B closes the window that has keyboard focus, as Ctrl+W does. A control that uses B itself, such as an open combo box or a held inventory item, keeps it. Escape on a keyboard does not close windows: it belongs to the game or its menu.
- The right stick scrolls the scroll area around the focused control. With no scroll area around it, or with focus on the workspace, it scrolls the first scroll area of the focused window. It never moves a window. In the window mode it resizes the window.
- MDI tab headers accept keyboard focus. Left and Right select a neighboring tab; Up and Down continue native content navigation. Submit selects the focused header.
- The workspace owns its tab action bindings, including player rebinds. A nested tab view does not also run its original shoulder binding. If the workspace has no tab actions, its nested tab views keep their own bindings.
- A gamepad command acts only while keyboard focus is inside the workspace. View (select) is the exception: with nothing focused, it goes to the toolbar. With nothing focused, Y and the right stick do nothing here, so a game can use those buttons itself.
- The south button activates the focused control. UI Toolkit does this
through the
UImap of the project-wide actions, not the workspace.
A cursor for mouse screens
A screen made for the mouse, such as a desktop or a node graph, can
add a VirtualCursor. The left stick
then moves an arrow that the panel sees as a mouse, A clicks, X clicks
with the right button and B raises Cancelled. While the arrow shows,
the right stick scrolls the scroll area under it, not the one around
the focus, and A and B do not also submit or cancel the focused
control. The d-pad still moves the focus, and the shoulder, trigger
and View commands above work as before. The arrow hides when the mouse
moves.
Shoulder marks
Set bumper-marks="true" (BumperMarks) to show an LB glyph on the
title bar of the previous window and an RB glyph on the next one. The
marks show only while the player uses a gamepad. Each mark is a
GamepadGlyph with the class tb-workspace__bumper-mark
(Workspace.BUMPER_MARK_CLASS).
<UIToolbox.Workspace bumper-marks="true" />
The marks are off by default. A game has its own button hints, and two more glyphs on its windows would repeat them. The demo scenes turn them on, because a demo is where a player learns the buttons.
Overview
workspace.ShowOverview() shows every open window in a grid to pick
one, as the task view of a desktop does. RB or LB held for 0.3 seconds
opens it, and so does Ctrl held after Ctrl+Tab.
- The windows themselves move and scale into the grid, with their aspect ratio, in 200 ms. The workspace dims behind them, and the icon and the title of each window show under its preview.
- The active window is picked first. The picked preview has the focus ring and lifts a little.
- The D-pad, the left stick, the arrow keys, Tab and RB or LB move the pick. Letting go of the held button or of Ctrl focuses the pick, and so do A, Enter and a click on a preview.
- B, Escape or a click on the background closes the overview with no change.
- A layer in front of the windows takes the clicks, so a click never reaches the content of a window.
- A minimized window shows restored, and stays minimized unless it is picked. A tab group or a dock with its tabs is one preview.
- When the overview closes, the windows go back to their bounds, their state and their order, and the picked window comes to the front.
- The animation makes no garbage per frame. With
animations-enabled="false"the windows move at once.
Set overview="false" (OverviewEnabled) to turn it off. The window
keys then only switch the windows.
<UIToolbox.Workspace overview="false" />
While it shows, IsOverviewOpen is true and the workspace has the
class tb-workspace--overview (Workspace.OVERVIEW_CLASS).
Window mode
workspace.ShowWindowMode() moves and resizes one window with the
gamepad or the keys, as a console desktop does. View held or Ctrl+Alt+Space
starts it on the focused window.
| Gamepad | Keys | Action |
|---|---|---|
| D-pad | Tab | Pick another window. |
| Left stick | Arrows | Move the window. |
| Right stick, LT, RT | Shift+Arrows | Resize the window. |
| A | Enter | Keep the new bounds and end the mode. |
| B | Escape | Put the windows back and end the mode. |
- The other windows dim, and a prompt bar shows the keys in the look of the device that the player used last.
- The window stays in the viewport and keeps its minimum size. A window that cannot be dragged or resized keeps its place or its size.
Set window-mode="false" (WindowModeEnabled) to turn it off. While
it is on, IsInWindowMode is true, the workspace has the class
tb-workspace--window-mode (Workspace.WINDOW_MODE_CLASS) and the
window has tb-window--mode-target
(Workspace.WINDOW_MODE_TARGET_CLASS).
Focus and the focus ring
NextWindowandPreviousWindowmove keyboard focus to the first control of the new window, or to the workspace when the window has no control. The user then navigates the controls of that window.- A window that opens while the user navigates with keys or a gamepad takes keyboard focus, so the next press acts in it. With a mouse, focus stays where it is.
- Keyboard focus that enters a window focuses that window and brings it to front, as a click does.
- While the user navigates with keys or a gamepad, the workspace has the class
tb-workspace--navigating(Workspace.NAVIGATING_CLASS). The theme then shows a focus ring on the focused button, toggle, slider, list or scroll view. A pointer press removes the class, so a mouse user sees no ring.
Action hints
Use PromptBar with explicit hints for the actions a screen supports.
Use Navigate for focus movement and Select for native control activation.
The focused button names the action, such as Scan or Restart challenge.
Only show Cancel when the focused interaction supports cancellation.
GamepadGlyph displays the current device family instead of Xbox-specific text.
Window cycling skips hidden and disabled controls. Closing a focused window, changing its active tab, or restoring a layout recovers focus inside an available window. A newer user focus takes priority over scheduled recovery.
Without the Input System package
The workspace reads the default keys from UI Toolkit KeyDownEvent. These keys are fixed. On macOS, Cmd replaces Ctrl.
Rules for both
- The shortcuts act only while UI Toolkit keyboard focus is in the workspace. The workspace is
focusable, so a click on a window or on empty workspace space gives it focus. ItstabIndexis -1, so Tab and the D-pad skip it. A focused control inside a window, such as aTextField, also counts. - Move and resize do nothing while a text field has focus, because the text field uses the arrow keys.
- Move and resize also wait while an inventory grid holds an item with keyboard or gamepad input. The right stick rotates the item, including while focus moves to its destination grid.
KeyboardFocus.IsInTextField(element)makes the same check for the keys of your game. It is true when the element, such aspanel.focusController.focusedElement, is a text field or is in one. Skip a key such as Q while it is true, so the player can type that letter in a chat field.- A window that opens or gets focus from code does not take keyboard focus while the user works with a mouse. Call
workspace.Focus()when the keys must work at once.NextWindowandPreviousWindowmove keyboard focus into the new window, and a window that opens during key or gamepad navigation takes it. - Dock windows and hidden tabs are not in the Ctrl+Tab order. A floating tab group counts as one window. Local tab commands select members of floating groups and docks.
- Commands target the member containing keyboard focus. Closing a dock tab cannot close a floating window behind it. Move and resize affect the floating group chrome; dock members stay fixed.
- A
KeyBindingFieldthat is listening keeps the input. Window shortcuts do nothing until binding capture finishes. - The D-pad and left stick navigate controls. Submit keeps the native control behavior. Cancel from a gamepad closes the focused window after the controls had their turn; Escape on a keyboard does not.
- Set
keyboard-shortcuts="false"when the application uses these keys for something else.RunCommandstays available for your own bindings.
Scrolling and selection
The right stick scrolls the nearest ScrollView containing keyboard focus. It works when a child button, field, or list has focus. Push down to scroll down and right to scroll right. At the edge of an inner view, its parent takes the remaining movement. Scrolling works while gameplay is paused.
The right stick never moves a window. With no scroll area around the focused control, it scrolls the focused window. In the window mode the right stick resizes the window. A held inventory item keeps its rotation input. A binding field that listens for input keeps that input. A modal scrolls its own content, not the background.
Keyboard, D-pad, and left-stick focus changes reveal the focused control inside its enclosing scroll areas. A shaped inventory also reveals its selected cell when navigation changes the selection within the grid. Manual right-stick scrolling does not change selection or snap back to it. The next focus change reveals the newly focused control.
This behavior applies to runtime panels registered by Toolbox controls, workspaces, popups, and the UIDocuments present when a scene loads. Editor panels retain Unity's editor behavior. Right-stick scrolling needs the Input System package; focus visibility also works without that package.