# formatForDisplay

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

## Call Signature

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

Defined in: [format.ts:168](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/format.ts#L168)

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`](../type-aliases/DisplayHotkeyChord.md)[]

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

#### options

[`FormatDisplayOptions`](../interfaces/FormatDisplayOptions.md) & `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
```

## Call Signature

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

Defined in: [format.ts:172](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/format.ts#L172)

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`](../type-aliases/DisplayHotkeyChord.md)

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

#### options

[`FormatDisplayOptions`](../interfaces/FormatDisplayOptions.md) & `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
```

## Call Signature

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

Defined in: [format.ts:176](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/format.ts#L176)

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`](../type-aliases/PlatformHotkeys.md)\<[`RegisterableHotkeyChord`](../type-aliases/RegisterableHotkeyChord.md)\>

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

#### options

[`FormatDisplayOptions`](../interfaces/FormatDisplayOptions.md) & `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
```

## Call Signature

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

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

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`](../type-aliases/PlatformHotkeys.md)\<[`RegisterableHotkeySequence`](../type-aliases/RegisterableHotkeySequence.md)\>

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

#### options

[`FormatDisplayOptions`](../interfaces/FormatDisplayOptions.md) & `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
```

## Call Signature

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

Defined in: [format.ts:184](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/format.ts#L184)

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`](../type-aliases/PlatformHotkeys.md)

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

#### options

[`FormatDisplayOptions`](../interfaces/FormatDisplayOptions.md) & `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
```

## Call Signature

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

Defined in: [format.ts:188](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/format.ts#L188)

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`](../type-aliases/DisplayHotkey.md)

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

#### options?

[`FormatDisplayOptions`](../interfaces/FormatDisplayOptions.md) & `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
```

## Call Signature

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

Defined in: [format.ts:192](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/format.ts#L192)

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`](../type-aliases/DisplayHotkey.md)

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

#### options

[`FormatDisplayOptions`](../interfaces/FormatDisplayOptions.md)

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
```
