Skip to content

@gtkx/react / ShortcutProps

Type Alias: ShortcutProps

ShortcutProps = object

Defined in: packages/react/src/jsx.ts:136

Props for the Shortcut virtual element.

Defines a keyboard shortcut. Must be a child of <GtkShortcutController>.

Example

tsx
<GtkShortcutController>
    &lt;x.Shortcut trigger="<Control>s" onActivate={save} />
    &lt;x.Shortcut trigger={["F5", "<Control>r"]} onActivate={refresh} />
    &lt;x.Shortcut trigger="Escape" onActivate={cancel} disabled={!canCancel} />
&lt;/GtkShortcutController>

Properties

disabled?

optional disabled?: boolean

Defined in: packages/react/src/jsx.ts:146

Whether the shortcut is disabled


onActivate

onActivate: () => boolean | void

Defined in: packages/react/src/jsx.ts:144

Called when the shortcut is activated. Return false to indicate the shortcut was not handled; otherwise it is considered handled.

Returns

boolean | void


trigger

trigger: string | string[]

Defined in: packages/react/src/jsx.ts:138

The trigger string(s) using GTK accelerator format (e.g., "<Control>s", "F1")