# shortcuts

URL: https://lbliii.github.io/chirp-ui/api/shortcuts/
Section: api
Description: Declarative keyboard-shortcut catalog for chirp-ui.

The catalog is the single source of truth: ``shortcuts_help.html`` renders the
help modal from it, and the ``chirpuiShortcuts`` Alpine factory dispatches from
the same data (serialized via `shortcuts_json`()). This makes the open-webui
#17015 class of bug structurally impossible — the modal cannot advertise a
binding the handler does not run, because both read one list.

Chirp-agnostic and stdlib-only, like ``route_tabs.py`` and ``grid_state.py``.

---

> For a complete page index, fetch https://lbliii.github.io/chirp-ui/llms.txt.

Declarative keyboard-shortcut catalog for chirp-ui.

The catalog is the single source of truth:`shortcuts_help.html`renders the
help modal from it, and the`chirpuiShortcuts`Alpine factory dispatches from
the same data (serialized via`shortcuts_json`()). This makes the open-webui
#17015 class of bug structurally impossible — the modal cannot advertise a
binding the handler does not run, because both read one list.

Chirp-agnostic and stdlib-only, like`route_tabs.py` and `grid_state.py`.

shortcuts

Name

Type

Default

Description

`type`

``

—

`qualified_name`

``

—

`element_type`

``

—

`description`

``

—

`source_file`

``

—

`line_number`

``

—

`is_autodoc`

``

—

`autodoc_element`

``

—

`_autodoc_template`

``

—

`_autodoc_url_path`

``

—

`_autodoc_page_type`

``

—

`title`

``

—

`doc_content_hash`

``

—

## Symbols on this page

class
Shortcut

One keyboard shortcut.

`keys` are display tokens rendered via `kbd()`in the modal (e.g.
`("⌘", "K")`). The handler matches on `mod`(ctrlKey||metaKey, unified),
…

Jump to symbol

(#Shortcut)

function
shortcuts_by_category

Group shortcuts by category for the help modal, preserving insertion order.

Jump to symbol

(#shortcuts_by_category)

function
shortcuts_json

Serialize the catalog for the`chirpuiShortcuts`Alpine factory.

Only the handler-relevant fields are emitted (display`keys`stay
server-side for the modal). Embedded in a …

Jump to symbol

(#shortcuts_json)

Shortcut

class

One keyboard shortcut.

`keys` are display tokens rendered via `kbd()`in the modal (e.g.
`("⌘", "K")`). The handler matches on `mod`(ctrlKey||metaKey, unified),
`shift`, and `event_key`(). `allow_in_input`opts a shortcut past the
input-context guard (Escape, focus-composer, composer send) — everything
else early-returns when focus is in a text field.

shortcuts_by_category

function

```
def shortcuts_by_category(shortcuts: tuple[Shortcut, ...] = DEFAULT_SHORTCUTS) -> dict[str, list[Shortcut]]
```

Group shortcuts by category for the help modal, preserving insertion order.

Parameters

Name

Type

Default

Description

`shortcuts`

`tuple[Shortcut, ...]`

`DEFAULT_SHORTCUTS`

shortcuts_json

function

```
def shortcuts_json(shortcuts: tuple[Shortcut, ...] = DEFAULT_SHORTCUTS) -> str
```

Serialize the catalog for the`chirpuiShortcuts`Alpine factory.

Only the handler-relevant fields are emitted (display`keys`stay
server-side for the modal). Embedded in a`<script type="application/json">`
so the handler reads the same data the modal rendered from.

Parameters

Name

Type

Default

Description

`shortcuts`

`tuple[Shortcut, ...]`

`DEFAULT_SHORTCUTS`

View source · /home/runner/work/chirp-ui/chirp-ui/site/../src/chirp_ui/shortcuts.py:1
(https://github.com/lbliii/chirp-ui/blob/main//home/runner/work/chirp-ui/chirp-ui/site/../src/chirp_ui/shortcuts.py#L1)
