# createKeyboardLayout

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

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

Defined in: [createKeyboardLayout.ts:32](https://github.com/TanStack/hotkeys/blob/main/packages/solid-hotkeys/src/createKeyboardLayout.ts#L32)

SolidJS primitive that returns a signal of the browser's keyboard layout,
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.

The layout loads after the first component that uses this primitive mounts,
so server-rendered output hydrates unchanged. `createFormatForDisplay` uses
this primitive, so you only need it for labels you draw yourself.

To never ask the browser for the layout, set `keyboardLayout: false` in
`HotkeysProvider`'s `defaultOptions`. The signal then stays `null`.

## Returns

Signal accessor for the keyboard layout, or `null`

() => `KeyboardLayoutMap` \| `null`

## Example

```tsx
function MoveKeys() {
  const layoutMap = createKeyboardLayout()
  const label = (code: string) =>
    (layoutMap()?.get(code) ?? code).toUpperCase()

  return <kbd>{label('KeyW')}</kbd>
}
```
