Skip to content

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

Free

Arrow Keys Horizontal Kbd for Ark UI

Left and right arrow caps side by side in one group, for a control that only moves along one axis.

A left arrow and a right arrow sit in one group. Up and down are left out. The group keeps the two caps together as one hint. No keys are listened for.

Use this pair for carousels, slides, and pagination. If the control is a button row, put the keys on those Button components. In React, Ark UI does not change the slide.

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">
  <KbdGroup>
    <Kbd>←</Kbd>
    <Kbd>→</Kbd>
  </KbdGroup>
</div>

FAQ

When should I show only the left and right arrows?

When the control only moves sideways: a carousel, a slideshow, a timeline, previous and next pages. Showing up and down there suggests keys that do nothing.

What does KbdGroup do for the arrows?

It lays the two Kbd caps out in a row with a small gap and keeps them on one line. Unlike a chord such as ⌘K, the arrows here are alternatives, so make that clear in the text around them, for example Use ← → to move.

Should left come before right?

Yes, as on the keyboard, with left first. In right-to-left interfaces a carousel usually moves the other way, so check which key goes forward and label the hint to match.

Should pagination use arrows or page labels?

Both: keep visible Previous and Next buttons with clear labels, and show the arrow hint for people who prefer the keyboard. Arrows alone don't say where they lead.

Are the arrow hints accessible?

The characters ← and → aren't always read as key names, so add visually hidden text like Left arrow and Right arrow inside the caps when the hint matters.

API Reference

Kbd

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