Skip to content

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

Free

Enter with Icon Kbd for Ark UI

An Enter cap with a return arrow icon before the word Enter. The icon is decorative, and the key is not wired up.

One cap shows a return arrow, hidden from assistive tech, then the word Enter. The icon and the word share the cap. Nothing submits.

Keep the word, because the icon is hidden. Submit still belongs on a Button. In React, Ark UI does not catch the Enter key.

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>
      <CornerDownLeftIcon aria-hidden="true" />
      Enter
    </Kbd>
  </KbdGroup>
</div>

FAQ

Why add an icon when the word is clear?

The return arrow is printed on many keys, so people find it faster on the keyboard. It also makes the hint easy to spot at the bottom of a command palette or a chat input.

Do screen readers read the icon?

No, it has aria-hidden, so screen readers read only Enter. Hide decorative icons like this one, and add text whenever the icon is all there is.

How are icons sized inside a Kbd?

The Kbd sizes any icon without its own size class to 12 pixels and spaces it from the text with a small gap. Give the icon a size class, like size-4, to override it.

Should I use an icon or the ↵ character?

The ↵ character needs no import and takes the cap's font, as in the Unicode Symbols example. The icon has a consistent stroke that matches other icons in your interface.

Should the icon go before or after the word?

Before, as here, so the shape is seen first. Keep one order for every key with an icon in your app.

When should a form show the Enter hint?

When Enter does something people might not expect: sends a message, adds a tag, picks a search result. In a regular form, Enter submits and needs no hint.

API Reference

Kbd

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