Skip to content

shadcn.io is an independent project built on shadcn/ui

Free

WASD Gaming Keys Kbd for Ark UI

The W, A, S, and D movement keys in an inverted T, the same layout games use for those four letters.

W sits above A, S, and D on a three-column grid, with empty cells beside W. The letters are caps, not controls. Nothing listens for them.

Use WASD when players expect those letters. Show arrow keys for a general app. Clicks still need a Button. In React, Ark UI does not move a character.

Preview

Preview width

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.

Anatomy

Kbd anatomy: kbd, group

Usage

<div className="rounded-md border bg-background p-4">
  <div className="grid w-fit grid-cols-3 gap-1">
    <div />
    <Kbd>W</Kbd>
    <div />
    <Kbd>A</Kbd>
    <Kbd>S</Kbd>
    <Kbd>D</Kbd>
  </div>
</div>

FAQ

When should I show WASD instead of arrow keys?

For games and 3D or canvas views where the right hand uses the mouse. For interfaces and lists, show the arrow keys. Supporting both is common.

Why lay WASD out like the arrow keys?

The keys form the same shape on the keyboard, W above and A, S, D below, and the layout makes the mapping to up, left, down and right obvious.

How do WASD controls work on other keyboard layouts?

On AZERTY, the same positions are Z, Q, S and D. Read event.code (KeyW, KeyA…) instead of event.key: it names the physical position, so the controls work on any layout. Show the user's own letters if you can.

Should the hint include Space for jump?

If your game uses it, add a wide Space cap below the cluster. Keep the other keys, like Shift to run or E to interact, in a separate list so the movement cluster stays readable.

How do I show WASD together with mouse controls?

Put the WASD cluster for Move next to a mouse icon for Look, with labels under each. People read the controls as two hands.

Are WASD hints accessible?

Screen readers read the letters, so add Move after the cluster for context. Let players remap movement keys: some can't use WASD comfortably.

API Reference

Kbd

No extra props in this demo. The rest is on the Kbd page.