# App Switcher

- Entry point: `@koobiq/components/app-switcher`
- NgModule: `KbqAppSwitcherModule`
- API: https://koobiq.io/api/app-switcher.md
- Component tokens: https://koobiq.io/tokens/app-switcher.md
- Page: https://koobiq.io/en/components/app-switcher/overview

A menu for switching between applications and platforms.

[**Example: app-switcher** (`app-switcher-overview`)](https://koobiq.io/examples/app-switcher-overview.md)

## Application icons

An application can carry either `iconSrc` — a URL loaded into an `<img>` — or `icon`, inline SVG markup rendered
into the DOM. Because inline markup ends up in the page, it is sanitized against a strict SVG allow-list before
rendering: `<script>`, `<style>`, `<foreignObject>`, HTML elements, every `on*` handler and any reference to an
external resource are removed, and markup that changes shape when re-parsed is dropped entirely. An icon that
loses everything falls back to `iconSrc`.

Prefer `iconSrc` for icons that come from a server. If the sanitizer strips something a legitimate icon needs,
the icon is likely relying on a feature (external references, embedded HTML) that does not belong in an inline
icon.

## Multiple platforms

When the system has multiple platforms, the applications of the selected platform are shown at the top of the list and the platform name is displayed. Other platforms are collapsed at the bottom of the list. 4 or more applications of the same type within a platform are grouped together. The main platform is marked with a badge.

Search appears when more than 7 applications are available. Results are displayed as a flat list.

[**Example: app-switcher-sites** (`app-switcher-sites`)](https://koobiq.io/examples/app-switcher-sites.md)

## Keyboard navigation

The list of applications can be operated entirely from the keyboard.

| Key           | Action                                                                         |
| ------------- | ------------------------------------------------------------------------------ |
| ↑ / ↓         | Move focus to the previous/next item.                                          |
| Home / End    | Move focus to the first/last item.                                             |
| →             | Expand an application group, or open the flyout of another platform.           |
| ←             | Collapse a group, move from an alias to its group, or close a platform flyout. |
| Enter / Space | Open the focused application, or expand/collapse a group.                      |
| Esc           | Close the switcher.                                                            |

Typing the first letters of an item jumps to it. When search is available, ↓ moves focus from the search field into the list, and ↑ on the first item returns focus to the search field.
