# AlpineHotkeys

<!-- DO NOT EDIT: this page is autogenerated from the type comments -->

Defined in: [types.ts:111](https://github.com/TanStack/hotkeys/blob/main/packages/alpine-hotkeys/src/types.ts#L111)

Registrations and reactive state owned by one Alpine component.

## Properties

### createAppHotkeyList

```ts
createAppHotkeyList: () => AlpineHotkeyState<RegisteredAppHotkeyListItem[]>;
```

Defined in: [types.ts:289](https://github.com/TanStack/hotkeys/blob/main/packages/alpine-hotkeys/src/types.ts#L289)

Read every app hotkey with its live status through `.value`.

#### Returns

[`AlpineHotkeyState`](AlpineHotkeyState.md)\<`RegisteredAppHotkeyListItem`[]\>

***

### createAppHotkeys

```ts
createAppHotkeys: () => AlpineHotkeyState<Readonly<Record<string, AppHotkey<string, AppHotkeyBinding>>>>;
```

Defined in: [types.ts:287](https://github.com/TanStack/hotkeys/blob/main/packages/alpine-hotkeys/src/types.ts#L287)

Read the effective app hotkeys from `provideAppHotkeys` through `.value`.

#### Returns

[`AlpineHotkeyState`](AlpineHotkeyState.md)\<`Readonly`\<`Record`\<`string`, `AppHotkey`\<`string`, `AppHotkeyBinding`\>\>\>\>

***

### createCustomHotkeys

```ts
createCustomHotkeys: () => AlpineCustomHotkeys;
```

Defined in: [types.ts:293](https://github.com/TanStack/hotkeys/blob/main/packages/alpine-hotkeys/src/types.ts#L293)

Read and change the user's custom hotkeys.

#### Returns

[`AlpineCustomHotkeys`](AlpineCustomHotkeys.md)

***

### createFormatForAria

```ts
createFormatForAria: () => (input, options) => string | undefined;
```

Defined in: [types.ts:253](https://github.com/TanStack/hotkeys/blob/main/packages/alpine-hotkeys/src/types.ts#L253)

Returns `formatForAria` with the scope's `platform` as the default, or the
detected platform without one. Use its value for `aria-keyshortcuts`, so
screen readers announce the shortcut. It returns `undefined` for a
multi-step sequence, no hotkey, or a hotkey that can't fire right now (one
that is disabled, in a suspended scope, a suspended character key, or not
registered), so `x-bind` omits the attribute. An explicit `platform`
option wins.

Physical bindings such as `[KeyQ]` name the key the user presses in
Chromium browsers, once the keyboard layout has loaded, the same way as
`createFormatForDisplay`. A `layoutMap` passed to the returned function
wins.

Create it once, then call the returned function anywhere.

#### Returns

```ts
(input, options?): string | undefined;
```

Formats a hotkey for an `aria-keyshortcuts` attribute so screen readers can
announce the shortcut. `Mod+K` becomes `Meta+K` on macOS and `Control+K`
elsewhere.

Modifiers use the ARIA names (`Control`, `Alt`, `Shift`, `Meta`) and come
before the key. Keys use `KeyboardEvent.key` values, such as `K`, `/`,
`Escape`, or `ArrowUp`, with `Space` for the space bar and `Plus` for the
plus key. A physical binding names the key at that position, so `[KeyQ]`
becomes `Q`, or the key from `layoutMap` such as `A` on a French AZERTY
keyboard. Logical punctuation stays as written, so `'?'` stays `?` even
where it takes Shift to type.

Returns `undefined` when the hotkey has no ARIA form, so the attribute is
omitted. This applies to empty or `null` hotkeys, multi-step sequences,
standalone modifiers, and physical codes with no key value such as
`[NumpadMemoryAdd]`. A one-step sequence formats like its chord.

A hotkey object with `alternates` lists every chord for the platform,
separated by spaces, which is how the attribute names more than one
shortcut. Its sequences are left out. For two unrelated shortcuts on one
control, join both formatted values with a space.
In a server-rendered app, use your adapter's formatter or pass `platform`.
Without a `platform` option, `formatForAria` uses `'linux'` on the server,
like `formatForDisplay`.

##### Parameters

###### input

`DisplayHotkey` \| `null` \| `undefined`

A hotkey string, raw object, parsed chord, hotkey object, or nothing

###### options?

`FormatAriaOptions` = `{}`

The platform and keyboard layout

##### Returns

`string` \| `undefined`

The attribute value, or `undefined` when there is none

##### Example

```ts
formatForAria('Mod+K', { platform: 'mac' }) // 'Meta+K'
formatForAria('Mod+Shift+P', { platform: 'windows' }) // 'Control+Shift+P'
formatForAria('Shift+Space') // 'Shift+Space'
formatForAria(['G', 'H']) // undefined
formatForAria({ default: 'Mod+Y', alternates: ['Mod+Shift+Z'] }, { platform: 'windows' })
// 'Control+Y Control+Shift+Z'
```

#### Example

```ts
Alpine.data('searchButton', () => {
  const hotkeys = createHotkeysScope()
  const formatForAria = hotkeys.createFormatForAria()

  return {
    get shortcut() {
      return formatForAria('Mod+K')
    },
    destroy() {
      hotkeys.destroy()
    },
  }
})
```

```html
<button x-data="searchButton" :aria-keyshortcuts="shortcut">Search</button>
```

***

### createFormatForDisplay

```ts
createFormatForDisplay: () => {
  (hotkey, options): string[][];
  (hotkey, options): string[];
  (hotkey, options): string[];
  (hotkey, options): string[][];
  (hotkey, options): string[] | string[][];
  (hotkey, options?): string;
  (hotkey, options): string | string[] | string[][];
};
```

Defined in: [types.ts:215](https://github.com/TanStack/hotkeys/blob/main/packages/alpine-hotkeys/src/types.ts#L215)

Returns `formatForDisplay` with the scope's `platform` as the default, or
the detected platform without one. A `platform` passed to the returned
function wins.

Physical bindings such as `[KeyQ]` are labeled with the character the key
types for this user in Chromium browsers, once the keyboard layout has
loaded. A getter or an `x-text` expression that calls the function runs
again when the layout arrives. See `createKeyboardLayout`. A `layoutMap`
passed to the returned function wins. To never ask the browser for the
layout, set `keyboardLayout: false` in the scope's default options. Firefox
and Safari report no layout, so labels there keep the key's US character.

Create it once, then call the returned function anywhere.

#### Returns

```ts
(hotkey, options): string[][];
```

Formats a hotkey for display in a user interface.

In a server-rendered app, format labels with your adapter's formatter,
such as `useFormatForDisplay`, or pass `platform`. Called directly,
`formatForDisplay` never reads a provider's `platform`. Without a
`platform` option, it renders Linux labels on the server, so Mac users get
a different label after hydration.

On macOS, uses symbols (⇧⌘S) in Control, Option, Shift, Command order.
Display ordering does not change the normalized hotkey used for registration.
On Windows/Linux, uses text (Ctrl+Shift+S) with `+` separators.
The separator can be customized with `separatorToken`.
Physical codes use conventional display labels: `[KeyS]` becomes `S` and
`[Digit2]` becomes `2`. Keys with no US key use their keycap legends:
`[IntlBackslash]` and `[IntlRo]` become `\` and `[IntlYen]` becomes `¥`.
These labels do not infer the active keyboard layout or change matching.
Supply a resolved `layoutMap` for layout-aware labels; `keyLabels`
overrides both layout entries and fallback labels.
Sequence steps are formatted individually and joined with `sequenceSeparator`
(a space by default).
A hotkey object formats as its first hotkey for the platform, or as its
first alternate where the platform has only alternates. With
`alternatesSeparator`, it formats every hotkey for the platform.

On a right-to-left page, the browser can display a label in reverse order.
Set `dir="ltr"` on the label's element, or pass `isolate` where the label
is part of a longer string.

A key reported by a `KeyboardEvent`, such as a held key from
`KeyStateTracker`, can be outside the key types: pass it as `{ key }`.

##### Parameters

###### hotkey

readonly `DisplayHotkeyChord`[]

A logical or physical hotkey string, raw object, ParsedHotkeyChord, sequence, or hotkey object

###### options

`FormatDisplayOptions` & `object`

Formatting options

##### Returns

`string`[][]

Display text, or individual key labels when parts is true (one array per step for sequences)

##### Example

```ts
formatForDisplay('Mod+Shift+S', { platform: 'mac' })
// Returns: '⇧ ⌘ S' (symbols separated by spaces on macOS)

formatForDisplay('Mod+Shift+S', { platform: 'windows' })
// Returns: 'Ctrl+Shift+S'

formatForDisplay('Escape')
// Returns: 'Esc' (on all platforms)

formatForDisplay('Shift', { platform: 'mac' })
// Returns: '⇧'

formatForDisplay({ key: heldKey })
// A key from a KeyboardEvent, such as a held key

formatForDisplay(['G', 'H'])
// Returns: 'G H'

formatForDisplay(
  { default: 'Mod+Y', alternates: ['Mod+Shift+Z'] },
  { platform: 'windows', alternatesSeparator: ' or ' },
)
// Returns: 'Ctrl+Y or Ctrl+Shift+Z'

formatForDisplay('Mod+[', { platform: 'windows', isolate: true })
// Returns: 'Ctrl+[' between U+2066 and U+2069
```

```ts
(hotkey, options): string[];
```

Formats a hotkey for display in a user interface.

In a server-rendered app, format labels with your adapter's formatter,
such as `useFormatForDisplay`, or pass `platform`. Called directly,
`formatForDisplay` never reads a provider's `platform`. Without a
`platform` option, it renders Linux labels on the server, so Mac users get
a different label after hydration.

On macOS, uses symbols (⇧⌘S) in Control, Option, Shift, Command order.
Display ordering does not change the normalized hotkey used for registration.
On Windows/Linux, uses text (Ctrl+Shift+S) with `+` separators.
The separator can be customized with `separatorToken`.
Physical codes use conventional display labels: `[KeyS]` becomes `S` and
`[Digit2]` becomes `2`. Keys with no US key use their keycap legends:
`[IntlBackslash]` and `[IntlRo]` become `\` and `[IntlYen]` becomes `¥`.
These labels do not infer the active keyboard layout or change matching.
Supply a resolved `layoutMap` for layout-aware labels; `keyLabels`
overrides both layout entries and fallback labels.
Sequence steps are formatted individually and joined with `sequenceSeparator`
(a space by default).
A hotkey object formats as its first hotkey for the platform, or as its
first alternate where the platform has only alternates. With
`alternatesSeparator`, it formats every hotkey for the platform.

On a right-to-left page, the browser can display a label in reverse order.
Set `dir="ltr"` on the label's element, or pass `isolate` where the label
is part of a longer string.

A key reported by a `KeyboardEvent`, such as a held key from
`KeyStateTracker`, can be outside the key types: pass it as `{ key }`.

##### Parameters

###### hotkey

`DisplayHotkeyChord`

A logical or physical hotkey string, raw object, ParsedHotkeyChord, sequence, or hotkey object

###### options

`FormatDisplayOptions` & `object`

Formatting options

##### Returns

`string`[]

Display text, or individual key labels when parts is true (one array per step for sequences)

##### Example

```ts
formatForDisplay('Mod+Shift+S', { platform: 'mac' })
// Returns: '⇧ ⌘ S' (symbols separated by spaces on macOS)

formatForDisplay('Mod+Shift+S', { platform: 'windows' })
// Returns: 'Ctrl+Shift+S'

formatForDisplay('Escape')
// Returns: 'Esc' (on all platforms)

formatForDisplay('Shift', { platform: 'mac' })
// Returns: '⇧'

formatForDisplay({ key: heldKey })
// A key from a KeyboardEvent, such as a held key

formatForDisplay(['G', 'H'])
// Returns: 'G H'

formatForDisplay(
  { default: 'Mod+Y', alternates: ['Mod+Shift+Z'] },
  { platform: 'windows', alternatesSeparator: ' or ' },
)
// Returns: 'Ctrl+Y or Ctrl+Shift+Z'

formatForDisplay('Mod+[', { platform: 'windows', isolate: true })
// Returns: 'Ctrl+[' between U+2066 and U+2069
```

```ts
(hotkey, options): string[];
```

Formats a hotkey for display in a user interface.

In a server-rendered app, format labels with your adapter's formatter,
such as `useFormatForDisplay`, or pass `platform`. Called directly,
`formatForDisplay` never reads a provider's `platform`. Without a
`platform` option, it renders Linux labels on the server, so Mac users get
a different label after hydration.

On macOS, uses symbols (⇧⌘S) in Control, Option, Shift, Command order.
Display ordering does not change the normalized hotkey used for registration.
On Windows/Linux, uses text (Ctrl+Shift+S) with `+` separators.
The separator can be customized with `separatorToken`.
Physical codes use conventional display labels: `[KeyS]` becomes `S` and
`[Digit2]` becomes `2`. Keys with no US key use their keycap legends:
`[IntlBackslash]` and `[IntlRo]` become `\` and `[IntlYen]` becomes `¥`.
These labels do not infer the active keyboard layout or change matching.
Supply a resolved `layoutMap` for layout-aware labels; `keyLabels`
overrides both layout entries and fallback labels.
Sequence steps are formatted individually and joined with `sequenceSeparator`
(a space by default).
A hotkey object formats as its first hotkey for the platform, or as its
first alternate where the platform has only alternates. With
`alternatesSeparator`, it formats every hotkey for the platform.

On a right-to-left page, the browser can display a label in reverse order.
Set `dir="ltr"` on the label's element, or pass `isolate` where the label
is part of a longer string.

A key reported by a `KeyboardEvent`, such as a held key from
`KeyStateTracker`, can be outside the key types: pass it as `{ key }`.

##### Parameters

###### hotkey

`PlatformHotkeys`\<`RegisterableHotkeyChord`\>

A logical or physical hotkey string, raw object, ParsedHotkeyChord, sequence, or hotkey object

###### options

`FormatDisplayOptions` & `object`

Formatting options

##### Returns

`string`[]

Display text, or individual key labels when parts is true (one array per step for sequences)

##### Example

```ts
formatForDisplay('Mod+Shift+S', { platform: 'mac' })
// Returns: '⇧ ⌘ S' (symbols separated by spaces on macOS)

formatForDisplay('Mod+Shift+S', { platform: 'windows' })
// Returns: 'Ctrl+Shift+S'

formatForDisplay('Escape')
// Returns: 'Esc' (on all platforms)

formatForDisplay('Shift', { platform: 'mac' })
// Returns: '⇧'

formatForDisplay({ key: heldKey })
// A key from a KeyboardEvent, such as a held key

formatForDisplay(['G', 'H'])
// Returns: 'G H'

formatForDisplay(
  { default: 'Mod+Y', alternates: ['Mod+Shift+Z'] },
  { platform: 'windows', alternatesSeparator: ' or ' },
)
// Returns: 'Ctrl+Y or Ctrl+Shift+Z'

formatForDisplay('Mod+[', { platform: 'windows', isolate: true })
// Returns: 'Ctrl+[' between U+2066 and U+2069
```

```ts
(hotkey, options): string[][];
```

Formats a hotkey for display in a user interface.

In a server-rendered app, format labels with your adapter's formatter,
such as `useFormatForDisplay`, or pass `platform`. Called directly,
`formatForDisplay` never reads a provider's `platform`. Without a
`platform` option, it renders Linux labels on the server, so Mac users get
a different label after hydration.

On macOS, uses symbols (⇧⌘S) in Control, Option, Shift, Command order.
Display ordering does not change the normalized hotkey used for registration.
On Windows/Linux, uses text (Ctrl+Shift+S) with `+` separators.
The separator can be customized with `separatorToken`.
Physical codes use conventional display labels: `[KeyS]` becomes `S` and
`[Digit2]` becomes `2`. Keys with no US key use their keycap legends:
`[IntlBackslash]` and `[IntlRo]` become `\` and `[IntlYen]` becomes `¥`.
These labels do not infer the active keyboard layout or change matching.
Supply a resolved `layoutMap` for layout-aware labels; `keyLabels`
overrides both layout entries and fallback labels.
Sequence steps are formatted individually and joined with `sequenceSeparator`
(a space by default).
A hotkey object formats as its first hotkey for the platform, or as its
first alternate where the platform has only alternates. With
`alternatesSeparator`, it formats every hotkey for the platform.

On a right-to-left page, the browser can display a label in reverse order.
Set `dir="ltr"` on the label's element, or pass `isolate` where the label
is part of a longer string.

A key reported by a `KeyboardEvent`, such as a held key from
`KeyStateTracker`, can be outside the key types: pass it as `{ key }`.

##### Parameters

###### hotkey

`PlatformHotkeys`\<`RegisterableHotkeySequence`\>

A logical or physical hotkey string, raw object, ParsedHotkeyChord, sequence, or hotkey object

###### options

`FormatDisplayOptions` & `object`

Formatting options

##### Returns

`string`[][]

Display text, or individual key labels when parts is true (one array per step for sequences)

##### Example

```ts
formatForDisplay('Mod+Shift+S', { platform: 'mac' })
// Returns: '⇧ ⌘ S' (symbols separated by spaces on macOS)

formatForDisplay('Mod+Shift+S', { platform: 'windows' })
// Returns: 'Ctrl+Shift+S'

formatForDisplay('Escape')
// Returns: 'Esc' (on all platforms)

formatForDisplay('Shift', { platform: 'mac' })
// Returns: '⇧'

formatForDisplay({ key: heldKey })
// A key from a KeyboardEvent, such as a held key

formatForDisplay(['G', 'H'])
// Returns: 'G H'

formatForDisplay(
  { default: 'Mod+Y', alternates: ['Mod+Shift+Z'] },
  { platform: 'windows', alternatesSeparator: ' or ' },
)
// Returns: 'Ctrl+Y or Ctrl+Shift+Z'

formatForDisplay('Mod+[', { platform: 'windows', isolate: true })
// Returns: 'Ctrl+[' between U+2066 and U+2069
```

```ts
(hotkey, options): string[] | string[][];
```

Formats a hotkey for display in a user interface.

In a server-rendered app, format labels with your adapter's formatter,
such as `useFormatForDisplay`, or pass `platform`. Called directly,
`formatForDisplay` never reads a provider's `platform`. Without a
`platform` option, it renders Linux labels on the server, so Mac users get
a different label after hydration.

On macOS, uses symbols (⇧⌘S) in Control, Option, Shift, Command order.
Display ordering does not change the normalized hotkey used for registration.
On Windows/Linux, uses text (Ctrl+Shift+S) with `+` separators.
The separator can be customized with `separatorToken`.
Physical codes use conventional display labels: `[KeyS]` becomes `S` and
`[Digit2]` becomes `2`. Keys with no US key use their keycap legends:
`[IntlBackslash]` and `[IntlRo]` become `\` and `[IntlYen]` becomes `¥`.
These labels do not infer the active keyboard layout or change matching.
Supply a resolved `layoutMap` for layout-aware labels; `keyLabels`
overrides both layout entries and fallback labels.
Sequence steps are formatted individually and joined with `sequenceSeparator`
(a space by default).
A hotkey object formats as its first hotkey for the platform, or as its
first alternate where the platform has only alternates. With
`alternatesSeparator`, it formats every hotkey for the platform.

On a right-to-left page, the browser can display a label in reverse order.
Set `dir="ltr"` on the label's element, or pass `isolate` where the label
is part of a longer string.

A key reported by a `KeyboardEvent`, such as a held key from
`KeyStateTracker`, can be outside the key types: pass it as `{ key }`.

##### Parameters

###### hotkey

`PlatformHotkeys`

A logical or physical hotkey string, raw object, ParsedHotkeyChord, sequence, or hotkey object

###### options

`FormatDisplayOptions` & `object`

Formatting options

##### Returns

`string`[] \| `string`[][]

Display text, or individual key labels when parts is true (one array per step for sequences)

##### Example

```ts
formatForDisplay('Mod+Shift+S', { platform: 'mac' })
// Returns: '⇧ ⌘ S' (symbols separated by spaces on macOS)

formatForDisplay('Mod+Shift+S', { platform: 'windows' })
// Returns: 'Ctrl+Shift+S'

formatForDisplay('Escape')
// Returns: 'Esc' (on all platforms)

formatForDisplay('Shift', { platform: 'mac' })
// Returns: '⇧'

formatForDisplay({ key: heldKey })
// A key from a KeyboardEvent, such as a held key

formatForDisplay(['G', 'H'])
// Returns: 'G H'

formatForDisplay(
  { default: 'Mod+Y', alternates: ['Mod+Shift+Z'] },
  { platform: 'windows', alternatesSeparator: ' or ' },
)
// Returns: 'Ctrl+Y or Ctrl+Shift+Z'

formatForDisplay('Mod+[', { platform: 'windows', isolate: true })
// Returns: 'Ctrl+[' between U+2066 and U+2069
```

```ts
(hotkey, options?): string;
```

Formats a hotkey for display in a user interface.

In a server-rendered app, format labels with your adapter's formatter,
such as `useFormatForDisplay`, or pass `platform`. Called directly,
`formatForDisplay` never reads a provider's `platform`. Without a
`platform` option, it renders Linux labels on the server, so Mac users get
a different label after hydration.

On macOS, uses symbols (⇧⌘S) in Control, Option, Shift, Command order.
Display ordering does not change the normalized hotkey used for registration.
On Windows/Linux, uses text (Ctrl+Shift+S) with `+` separators.
The separator can be customized with `separatorToken`.
Physical codes use conventional display labels: `[KeyS]` becomes `S` and
`[Digit2]` becomes `2`. Keys with no US key use their keycap legends:
`[IntlBackslash]` and `[IntlRo]` become `\` and `[IntlYen]` becomes `¥`.
These labels do not infer the active keyboard layout or change matching.
Supply a resolved `layoutMap` for layout-aware labels; `keyLabels`
overrides both layout entries and fallback labels.
Sequence steps are formatted individually and joined with `sequenceSeparator`
(a space by default).
A hotkey object formats as its first hotkey for the platform, or as its
first alternate where the platform has only alternates. With
`alternatesSeparator`, it formats every hotkey for the platform.

On a right-to-left page, the browser can display a label in reverse order.
Set `dir="ltr"` on the label's element, or pass `isolate` where the label
is part of a longer string.

A key reported by a `KeyboardEvent`, such as a held key from
`KeyStateTracker`, can be outside the key types: pass it as `{ key }`.

##### Parameters

###### hotkey

`DisplayHotkey`

A logical or physical hotkey string, raw object, ParsedHotkeyChord, sequence, or hotkey object

###### options?

`FormatDisplayOptions` & `object`

Formatting options

##### Returns

`string`

Display text, or individual key labels when parts is true (one array per step for sequences)

##### Example

```ts
formatForDisplay('Mod+Shift+S', { platform: 'mac' })
// Returns: '⇧ ⌘ S' (symbols separated by spaces on macOS)

formatForDisplay('Mod+Shift+S', { platform: 'windows' })
// Returns: 'Ctrl+Shift+S'

formatForDisplay('Escape')
// Returns: 'Esc' (on all platforms)

formatForDisplay('Shift', { platform: 'mac' })
// Returns: '⇧'

formatForDisplay({ key: heldKey })
// A key from a KeyboardEvent, such as a held key

formatForDisplay(['G', 'H'])
// Returns: 'G H'

formatForDisplay(
  { default: 'Mod+Y', alternates: ['Mod+Shift+Z'] },
  { platform: 'windows', alternatesSeparator: ' or ' },
)
// Returns: 'Ctrl+Y or Ctrl+Shift+Z'

formatForDisplay('Mod+[', { platform: 'windows', isolate: true })
// Returns: 'Ctrl+[' between U+2066 and U+2069
```

```ts
(hotkey, options): string | string[] | string[][];
```

Formats a hotkey for display in a user interface.

In a server-rendered app, format labels with your adapter's formatter,
such as `useFormatForDisplay`, or pass `platform`. Called directly,
`formatForDisplay` never reads a provider's `platform`. Without a
`platform` option, it renders Linux labels on the server, so Mac users get
a different label after hydration.

On macOS, uses symbols (⇧⌘S) in Control, Option, Shift, Command order.
Display ordering does not change the normalized hotkey used for registration.
On Windows/Linux, uses text (Ctrl+Shift+S) with `+` separators.
The separator can be customized with `separatorToken`.
Physical codes use conventional display labels: `[KeyS]` becomes `S` and
`[Digit2]` becomes `2`. Keys with no US key use their keycap legends:
`[IntlBackslash]` and `[IntlRo]` become `\` and `[IntlYen]` becomes `¥`.
These labels do not infer the active keyboard layout or change matching.
Supply a resolved `layoutMap` for layout-aware labels; `keyLabels`
overrides both layout entries and fallback labels.
Sequence steps are formatted individually and joined with `sequenceSeparator`
(a space by default).
A hotkey object formats as its first hotkey for the platform, or as its
first alternate where the platform has only alternates. With
`alternatesSeparator`, it formats every hotkey for the platform.

On a right-to-left page, the browser can display a label in reverse order.
Set `dir="ltr"` on the label's element, or pass `isolate` where the label
is part of a longer string.

A key reported by a `KeyboardEvent`, such as a held key from
`KeyStateTracker`, can be outside the key types: pass it as `{ key }`.

##### Parameters

###### hotkey

`DisplayHotkey`

A logical or physical hotkey string, raw object, ParsedHotkeyChord, sequence, or hotkey object

###### options

`FormatDisplayOptions`

Formatting options

##### Returns

`string` \| `string`[] \| `string`[][]

Display text, or individual key labels when parts is true (one array per step for sequences)

##### Example

```ts
formatForDisplay('Mod+Shift+S', { platform: 'mac' })
// Returns: '⇧ ⌘ S' (symbols separated by spaces on macOS)

formatForDisplay('Mod+Shift+S', { platform: 'windows' })
// Returns: 'Ctrl+Shift+S'

formatForDisplay('Escape')
// Returns: 'Esc' (on all platforms)

formatForDisplay('Shift', { platform: 'mac' })
// Returns: '⇧'

formatForDisplay({ key: heldKey })
// A key from a KeyboardEvent, such as a held key

formatForDisplay(['G', 'H'])
// Returns: 'G H'

formatForDisplay(
  { default: 'Mod+Y', alternates: ['Mod+Shift+Z'] },
  { platform: 'windows', alternatesSeparator: ' or ' },
)
// Returns: 'Ctrl+Y or Ctrl+Shift+Z'

formatForDisplay('Mod+[', { platform: 'windows', isolate: true })
// Returns: 'Ctrl+[' between U+2066 and U+2069
```

#### Example

```ts
Alpine.data('saveButton', () => {
  const hotkeys = createHotkeysScope()
  const formatForDisplay = hotkeys.createFormatForDisplay()

  return {
    get label() {
      return formatForDisplay('Mod+S')
    },
    destroy() {
      hotkeys.destroy()
    },
  }
})
```

***

### createHeldKeyCodes

```ts
createHeldKeyCodes: () => AlpineHotkeyState<Record<string, string>>;
```

Defined in: [types.ts:126](https://github.com/TanStack/hotkeys/blob/main/packages/alpine-hotkeys/src/types.ts#L126)

Read the mapping of held logical names to physical codes through `.value`.

#### Returns

[`AlpineHotkeyState`](AlpineHotkeyState.md)\<`Record`\<`string`, `string`\>\>

***

### createHeldKeys

```ts
createHeldKeys: () => AlpineHotkeyState<string[]>;
```

Defined in: [types.ts:124](https://github.com/TanStack/hotkeys/blob/main/packages/alpine-hotkeys/src/types.ts#L124)

Read held logical key names through `.value`.

#### Returns

[`AlpineHotkeyState`](AlpineHotkeyState.md)\<`string`[]\>

***

### createHotkey

```ts
createHotkey: AlpineCreateHotkey;
```

Defined in: [types.ts:117](https://github.com/TanStack/hotkeys/blob/main/packages/alpine-hotkeys/src/types.ts#L117)

Register one hotkey: a chord such as `'Mod+S'`, a sequence such as
`['G', 'G']`, or an app hotkey. Getters track changing hotkeys and options.
`undefined`, `null`, or `''` registers nothing, for an optional shortcut.

***

### createHotkeyHint

```ts
createHotkeyHint: <T>(hotkey, options?) => AlpineHotkeyState<boolean>;
```

Defined in: [types.ts:171](https://github.com/TanStack/hotkeys/blob/main/packages/alpine-hotkeys/src/types.ts#L171)

Read whether held modifiers reveal a hotkey through `.value`. No hotkey
(`undefined`, `null`, or `''`) is never visible.

#### Type Parameters

##### T

`T` *extends* `AdapterHotkeyInput`

#### Parameters

##### hotkey

`IfTypeParameter`\<`T`, `MaybeGetter`\<`T` \| `null` \| `undefined`\>, `KnownHotkey`\<`T`, `MaybeGetter`\<`T` \| `null` \| `undefined`\>\>\>

##### options?

`MaybeGetter`\<`HeldModifierOptions`\>

#### Returns

[`AlpineHotkeyState`](AlpineHotkeyState.md)\<`boolean`\>

***

### createHotkeyRegistrations

```ts
createHotkeyRegistrations: () => HotkeyRegistrationsResult;
```

Defined in: [types.ts:180](https://github.com/TanStack/hotkeys/blob/main/packages/alpine-hotkeys/src/types.ts#L180)

Read live registrations, including disabled entries.

#### Returns

`HotkeyRegistrationsResult`

***

### createHotkeys

```ts
createHotkeys: (definitions, options?) => void;
```

Defined in: [types.ts:119](https://github.com/TanStack/hotkeys/blob/main/packages/alpine-hotkeys/src/types.ts#L119)

Reconcile a list of hotkeys. Definition options override common options.

#### Parameters

##### definitions

`MaybeGetter`\<readonly [`AlpineHotkeyDefinition`](../type-aliases/AlpineHotkeyDefinition.md)[]\>

##### options?

`MaybeGetter`\<[`AlpineHotkeyCommonOptions`](../type-aliases/AlpineHotkeyCommonOptions.md)\>

#### Returns

`void`

***

### createHotkeyScopesState

```ts
createHotkeyScopesState: () => AlpineHotkeyState<HotkeyScopesState>;
```

Defined in: [types.ts:182](https://github.com/TanStack/hotkeys/blob/main/packages/alpine-hotkeys/src/types.ts#L182)

Read the active, exclusive, allowed, and suspended scopes through `.value`.

#### Returns

[`AlpineHotkeyState`](AlpineHotkeyState.md)\<`HotkeyScopesState`\>

***

### createKeyboardLayout

```ts
createKeyboardLayout: () => AlpineHotkeyState<KeyboardLayoutMap | null>;
```

Defined in: [types.ts:285](https://github.com/TanStack/hotkeys/blob/main/packages/alpine-hotkeys/src/types.ts#L285)

Read the browser's keyboard layout through `.value`, or `null` until it
loads and in browsers that don't report one. The layout maps each physical
code to the character it types, such as `KeyQ` to `a` on a French AZERTY
keyboard. Only Chromium browsers report one.

Creating it is what loads the layout. The layout is read again when the
window regains focus, until the scope is destroyed.
`createFormatForDisplay` uses it, so you only need it for labels you draw
yourself.

To never ask the browser for the layout, set `keyboardLayout: false` in
the scope's default options. `.value` is then `null`.

#### Returns

[`AlpineHotkeyState`](AlpineHotkeyState.md)\<`KeyboardLayoutMap` \| `null`\>

#### Example

```ts
Alpine.data('moveKeys', () => {
  const hotkeys = createHotkeysScope()
  const layout = hotkeys.createKeyboardLayout()

  return {
    label(code: string) {
      return (layout.value?.get(code) ?? code).toUpperCase()
    },
    destroy() {
      hotkeys.destroy()
    },
  }
})
```

***

### createKeyHold

```ts
createKeyHold: (key) => AlpineHotkeyState<boolean>;
```

Defined in: [types.ts:128](https://github.com/TanStack/hotkeys/blob/main/packages/alpine-hotkeys/src/types.ts#L128)

Read whether a key is held through `.value`.

#### Parameters

##### key

`MaybeGetter`\<`IndividualKey`\>

#### Returns

[`AlpineHotkeyState`](AlpineHotkeyState.md)\<`boolean`\>

***

### createKeyLockState

```ts
createKeyLockState: (key) => AlpineHotkeyState<boolean | null>;
```

Defined in: [types.ts:164](https://github.com/TanStack/hotkeys/blob/main/packages/alpine-hotkeys/src/types.ts#L164)

Read whether a lock key, such as Caps Lock, is on through `.value`: `true`
when the lock is on, `false` when it is off, or `null`. Pass
`'CapsLock'`, `'NumLock'`, or `'ScrollLock'`, or a getter.

Lock keys toggle instead of being held, so this reads the lock state that
the browser reports on key and mouse events. `.value` is `null` until the
user presses a key, clicks, or moves the mouse, after the window loses
focus or the page is hidden, and always for Num Lock and Scroll Lock on macOS and iOS.

#### Parameters

##### key

`MaybeGetter`\<`LockKey`\>

#### Returns

[`AlpineHotkeyState`](AlpineHotkeyState.md)\<`boolean` \| `null`\>

#### Example

```ts
Alpine.data('passwordField', () => {
  const hotkeys = createHotkeysScope()
  const capsLock = hotkeys.createKeyLockState('CapsLock')

  return {
    get capsLockOn() {
      return capsLock.value === true
    },
    destroy() {
      hotkeys.destroy()
    },
  }
})
```

```html
<label x-data="passwordField">
  Password
  <input type="password" />
  <span x-show="capsLockOn" role="status">Caps Lock is on</span>
</label>
```

***

### destroy

```ts
destroy: () => void;
```

Defined in: [types.ts:295](https://github.com/TanStack/hotkeys/blob/main/packages/alpine-hotkeys/src/types.ts#L295)

Release every registration, subscription, effect, and recorder. Idempotent.

#### Returns

`void`
