Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Kbd examples · Arrow Keys

WASD Gaming Keys Kbd for React

The W, A, S and D movement keys in an inverted T, as games lay them out.

Framework
UI library

Games on a computer move with W, A, S and D, so the other hand can stay on the mouse. This React example places W above A, S and D on a three-column grid, with an empty cell on either side, so the four Kbd caps take the same inverted T as the arrow keys.

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.

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.