Skip to main content

Variable: AdwShortcutLabel

const AdwShortcutLabel: "AdwShortcutLabel"

Defined in: generated/jsx.ts:19254

A widget that displays a keyboard shortcut.

shortcut-label

The shown shortcut can be set using the ShortcutLabel.accelerator property.

Optionally, if no shortcut is set, AdwShortcutLabel will display a placeholder set with the ShortcutLabel.disabled-text property.

The following types of shortcuts can be displayed:

  • A single shortcut in Gtk.accelerator_parse format, e.g. <Control>C:

    shortcut-label-single

  • Multiple alternative shortcuts, separated with spaces, e.g. <Shift>A Home:

    shortcut-label-alternative

  • A range of shortcuts, separated with ..., e.g. <Alt>1...9:

    shortcut-label-range

  • Multiple keys pressed at once, separated with &, e.g. Control_L&Control_R:

    shortcut-label-multiple

  • Multiple shortcuts or keys, pressed sequentially, separated with +, e.g. <Control>C+<Control>X:

    shortcut-label-sequence

::: note <, > and & need to be escaped as &lt;, &gt; and &amp; when used in UI files.

CSS nodes

AdwShortcutLabel has a single CSS node with name shortcut-label. The individual keycap labels each have the .keycap style class, while the labels separating them have the .dimmed style class.

Accessibility

AdwShortcutLabel uses the GTK_ACCESSIBLE_ROLE_LABEL role.

See also: ShortcutsDialog.