Skip to content

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

Free

Vim Navigation Keys Kbd for Ark UI

The H, J, K, and L keys in one row, the four letters Vim uses to move the cursor. They are labels only.

Four caps in a four-column grid read H, J, K, and L. They sit in a row, not a cross. No cursor moves.

Use HJKL in a Vim-style app, and say which way each letter goes. For everyone else, show arrows. A Tooltip can carry the direction. In React, Ark UI does not move the cursor.

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.
Use email insteadNo credit card

Anatomy

Kbd anatomy: kbd, group

Usage

<div className="rounded-md border bg-background p-4">
  <div className="grid w-fit grid-cols-4 gap-1">
    <Kbd>H</Kbd>
    <Kbd>J</Kbd>
    <Kbd>K</Kbd>
    <Kbd>L</Kbd>
  </div>
</div>

FAQ

When should I document HJKL instead of arrow keys?

In tools for developers and keyboard-heavy users that support them: editors, terminals, list views in mail and issue trackers. Document the arrow keys as well, since most people don't know HJKL.

Why show HJKL in a row instead of a cross?

They are in a row on the keyboard, on the home row under the right hand. A cross would make them look like arrow keys and hide where the fingers actually go.

Should HJKL show which direction each key moves?

For anyone new to Vim, yes: H left, J down, K up, L right isn't obvious. Add a small label under each cap, or an arrow next to it.

Should I document modifier combinations too?

If your app supports them, list them separately, like Shift J or Ctrl D for half-page down. Keep this row for the four basic moves.

How do I show that HJKL only works outside text fields?

In Vim they work in normal mode; in a web app, they usually work when focus isn't in a text field. Say so next to the keys, for example When not typing.

Do HJKL hints make sense to people who don't use Vim?

Not on their own. Pair them with the arrow keys or with direction labels, and keep the arrow keys working everywhere HJKL does.

API Reference

Kbd

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