Tessera UI

Shortcut

Keyboard shortcut badges for documenting and displaying key combinations. Includes a standalone Key component for individual keys and a Shortcut wrapper for combos with configurable separators and RTL support.

Installation

pnpm add @tessinaui/ui

Usage

import { Key, Shortcut } from "@tessinaui/ui";
{/* Single key */}
<Key>Esc</Key>

{/* Shorthand — keys array */}
<Shortcut keys={["Ctrl", "K"]} />
<Shortcut keys={["Cmd", "Shift", "P"]} />

{/* Compound — children for custom compositions */}
<Shortcut>
  <Key>Ctrl</Key>
  <Key>K</Key>
</Shortcut>

{/* Mixed rounded per-key */}
<Shortcut>
  <Key>Cmd</Key>
  <Key rounded="full">⌘</Key>
</Shortcut>

{/* Rounded variant */}
<Shortcut keys={["Ctrl", "S"]} rounded="full" />

{/* Custom separator */}
<Shortcut keys={["Ctrl", "K"]} separator="then" />

{/* Size */}
<Shortcut keys={["Ctrl", "S"]} size="lg" />

{/* RTL */}
<Shortcut keys={["Ctrl", "Z"]} dir="rtl" />

Playground

Preview
Loading...

Showcase

Preview
Loading...

API Reference

Key props

PropTypeDefaultDescription
size"xs" | "sm" | "md" | "lg" | "xl""md"Visual size of the key badge (inherits from parent Shortcut)
rounded"none" | "sm" | "md" | "lg" | "full""md"Border radius (inherits from parent Shortcut)
classNamestringAdditional CSS classes

All native <kbd> HTML attributes are forwarded.

Shortcut props

PropTypeDefaultDescription
keysstring[]Shorthand: array of key labels with auto-inserted separators
childrenReactNodeCompound: Key components as children — separators auto-injected between them
separatorstring"+"Character(s) displayed between keys
size"xs" | "sm" | "md" | "lg" | "xl""md"Propagated to all child Key components via context
rounded"none" | "sm" | "md" | "lg" | "full""md"Propagated to all child Key components via context
dir"ltr" | "rtl""ltr"Text direction for RTL layouts
classNamestringAdditional CSS classes

children takes precedence over keys when both are provided. All native <span> HTML attributes are forwarded.

On this page