TanStack
Normalization & format API Reference

FormatDisplayOptions

Defined in: format.ts:312

Options for formatting hotkeys for display.

Properties

isolate?

ts
optional isolate?: boolean;

Defined in: format.ts:345

Wrap the label in the invisible Unicode characters U+2066 and U+2069, which keep its keys in left-to-right order inside right-to-left text. Each step of a sequence and each separator between steps is wrapped too. Use it on a right-to-left page where the label is part of a longer string, such as a placeholder or the text of an <option>. Where the label has its own element, set dir="ltr" on that element instead. Has no effect with parts: true. Default: false.


keyLabels?

ts
optional keyLabels?: Readonly<Record<string, string>>;

Defined in: format.ts:330

Final display overrides for logical keys or physical codes; take precedence over layoutMap. Never changes matching.


layoutMap?

ts
optional layoutMap?: object;

Defined in: format.ts:328

An already-resolved code-to-key map, such as KeyboardLayoutMap or Map. Used only for physical bindings. Mapped keys receive normal display formatting; missing or empty entries use conventional fallback labels. The caller owns loading and refreshing the map; this formatter never calls browser APIs.

get

ts
get: (code) => string | undefined;
Parameters
code

string

Returns

string | undefined


parts?

ts
optional parts?: boolean;

Defined in: format.ts:321

Return individual key labels instead of a joined string. Default: false.


platform?

ts
optional platform?: HotkeyPlatform;

Defined in: format.ts:317

The target platform. Without it, formatForDisplay detects the platform in the browser and uses 'linux' on a server.


separatorToken?

ts
optional separatorToken?: string | null;

Defined in: format.ts:332

Override the separator between display tokens. Defaults to platform-specific formatting when null/undefined.


sequenceSeparator?

ts
optional sequenceSeparator?: string;

Defined in: format.ts:334

Separator between sequence steps. Default: a space.


useSymbols?

ts
optional useSymbols?: 
  | boolean
  | {
  keys?: boolean;
  modifiers?: boolean;
};

Defined in: format.ts:319

Whether to use symbols for the display. Defaults to true.