---
agent:
  instructions: "Search goop.so for Goop's components, templates, design skill, docs, pricing and terms. Ask in keywords or a plain question, such as \"date picker props\" or \"is the design skill free\"; the answer is the matching page sections in Markdown, each with its address."
  endpoint: "https://goop.so/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Shortcut key

One keyboard key drawn as a small bordered cap inline in hint text, naming a chord with its neighbours, for React and Tailwind CSS. Free, MIT.

Free. Its export: `ShortcutKey`.

## Try it

Pick one key or a pair, or type keys of your own, a space or + between two: the keys sit in the sentence that names them.

Pressing the keys does nothing here: the shortcut key only shows them.

## When to use

- One keyboard key drawn as a small bordered cap inline in hint text, naming a chord with its neighbours.
- Also called: kbd or keyboard key.

## Installation

Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Shortcut key on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing.

```sh
npx shadcn@4.23.1 add @goop/meadow-shortcut-key
```

```text
Add the Goop Shortcut key to this project. The install steps are at https://goop.so/docs/install.md
```

## Usage

```tsx
import { ShortcutKey, ShortcutKeyGroup, ShortcutKeySeparator } from '@/components/ui/goop/shortcut-key';

function NewTaskHint() {
  return (
    <p className="flex items-center gap-1 text-base text-muted-foreground">
      Press
      <ShortcutKey>Ctrl</ShortcutKey>
      <ShortcutKey>N</ShortcutKey>
      to add a task
    </p>
  );
}

function FieldNoteShortcut() {
  return (
    <div className="flex items-center justify-between py-3">
      <span className="text-lg font-medium">Open a field note</span>
      <ShortcutKeyGroup size="lg" aria-label="Command J or Command K">
        <ShortcutKey>⌘</ShortcutKey>
        <ShortcutKey>J</ShortcutKey>
        <ShortcutKeySeparator />
        <ShortcutKey>⌘</ShortcutKey>
        <ShortcutKey>K</ShortcutKey>
      </ShortcutKeyGroup>
    </div>
  );
}
```

- Fits: settings, states: body.
- Also known as: Kbd.
- height, width, padding, gap, corner, background, text, motion: add no class for these.

## API reference

### Options

- `size: md | lg = md`
- `asChild?: boolean = false` — Render the key's look on the one child element instead of a `kbd`.

### Parts

- `ShortcutKeyGroup` — One key combination — a chord such as Command and K, or a choice of chords with a `ShortcutKeySeparator` between them — said to a reader as one group (a `kbd` of `kbd`s, HTML's own markup for a key combination); size?: 'md' | 'lg' = 'md' — The size of the keys and the joiner inside the group: md (the default) or lg
- `ShortcutKeySeparator` — The faint joiner between two chords in a `ShortcutKeyGroup` — a comma by default, or your own word ("or", "then")

- Class recipes (cva): shortcutKeyVariants (ShortcutKey)
- data-slot values (to select a part by): shortcut-key, shortcut-key-group, shortcut-key-separator

## Motion

- The part sets its own motion: add no transition or animation of your own.

## Notes for AI

Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.

## Related

- [Prose](/themes/meadow/components/prose): A block of running text set for reading, one paragraph or several, for a description, an article, a note or a help page.
- [Code block](/themes/meadow/components/code-block): A short value or command in the theme's mono, in a grey box, with a copy button beside it that copies it and says so.
- [Inline code](/themes/meadow/components/inline-code): A word or short phrase of code inside running text (a template word, a key, a path), in a small grey chip in the theme's mono.
- [Meta facts](/themes/meadow/components/meta-facts): A strip of a record's short facts, such as its status, owner and dates, each a label over its value.
