# Window Keyboard Navigation

This article describes how the Window keyboard navigation [works](https://www.telerik.com/blazor-ui/documentation/components/window/keyboard-navigation#default-keys) and how to [customize](https://www.telerik.com/blazor-ui/documentation/components/window/keyboard-navigation#using-custom-keys) it. The article extends the general information about [keyboard navigation in Telerik UI for Blazor](https://www.telerik.com/blazor-ui/documentation/accessibility/overview#keyboard-navigation).

The Window's keyboard navigation is active while the component is visible and focused.

## Default Keys

The following sections list the default built-in keyboard shortcuts and the actions that they perform when the Window is focused. Also check the [Window Keyboard Navigation demo](https://demos.telerik.com/blazor-ui/window/keyboard-navigation).

<style>
    .article table {
        table-layout: auto;
        word-break: normal;
    }
</style>

| Key Combination     | Description                                                           |
| ------------------- | --------------------------------------------------------------------- |
| `Alt` + `ArrowDown` | Minimizes a Window in the default state and restores it if maximized. |
| `Alt` + `ArrowUp`   | Maximizes a Window in the default state and restores it if minimized. |
| `Escape`            | Closes the Window.                                                    |

## Using Custom Keys

The Window supports replacing the default built-in keyboard shortcuts or adding new ones that perform the same actions.

To override the built-in Window keyboard shortcuts, you need to create a `Dictionary<string, WindowKeyboardCommand?>>` that defines:

* Key names as `string` values. Use the same key names as in the [`KeyboardEventArgs.Key`](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.components.web.keyboardeventargs.key) property, for example, `"B"`, `"Enter"`, or `"ArrowDown"`.
* Keyboard commands to execute as [`WindowKeyboardCommand`](https://www.telerik.com/blazor-ui/documentation/components/window/keyboard-navigation#keyboard-command) values.

Set the `Dictionary` to the Window `CustomKeyboardShortcuts` parameter.

> caption Setting custom WindowKeyboardCommand keyboard shortcuts

```RAZOR.skip-repl
<TelerikWindow CustomKeyboardShortcuts="@WindowCustomShortcuts" />

@code {
    private Dictionary<string, WindowKeyboardCommand?> WindowCustomShortcuts = new()
    {
        { "Escape", WindowKeyboardCommand.Minimize }
    };
}
```

### Keyboard Command

The [`WindowKeyboardCommand`](https://www.telerik.com/blazor-ui/documentation/api/telerik.blazor.components.windowkeyboardcommand) enum represents a user action, for example, `Minimize`, `Close`, and others.

You can define multiple keyboard shortcuts that execute the same keyboard command. If a Window keyboard command has no custom key, the component uses the default key. To disable a built-in keyboard command for a specific key, use `null`.

### Example

The following sample shows how to:

* Disable closing the Window with the `Escape` key.
* Minimize, restore, and maximize the Window with a custom key.

<demo metaUrl="client/window/keyboard-navigation/example-1/" height="420"></demo>

## See Also

* [Online Demo: Window Keyboard Navigation](https://demos.telerik.com/blazor-ui/window/keyboard-navigation)
* [Keyboard navigation in Telerik UI for Blazor](https://www.telerik.com/blazor-ui/documentation/accessibility/overview#keyboard-navigation)
* [Telerik UI for Blazor Accessibility Overview](https://www.telerik.com/blazor-ui/documentation/accessibility/overview)
