# Kbd (Lumen Halo): prompt.md (v1.0.0)

- id: `lumen-kbd` · version 1.0.0 · component · free
- category: Text & motion
- build: Base UI (one set of files; its dependencies follow the build)
- install (this build): `npx shadcn@latest add https://beautiful-ui.dev/r/lumen-kbd.json`
- npm dependencies: none
- registry dependencies: utils, https://beautiful-ui.dev/r/lumen-foundation.json
- docs: https://beautiful-ui.dev/components/lumen-kbd
- The install command carries everything this item needs (files, CSS, tokens, npm and registry dependencies). Prefer it to copying source by hand.

The key cap Lumen speaks shortcuts in: mono, recessed, the same in tooltips, fields and menus, so every shortcut on the page looks like one family. shadcn's Kbd, cut from Lumen glass.

## Build it
- Stack: React 19 (`ref` is a plain prop), TypeScript, Tailwind CSS v4 utilities, a shadcn-initialised project with the `@/*` alias.
- Packages: none beyond React.
- Files: `components/ui/lumen/kbd.tsx`.
- Registry dependencies, installed with it automatically: shadcn `utils` (cn), `lumen-foundation`.
- Builds: one set of files for both, but its dependencies come in Base UI and Radix builds. Install the one that matches the project (see Install): a free item's bare URL installs the Base UI build of it and its dependencies.
- Exports to keep: `Kbd`, `KbdGroup`, and every exported type.
- CSS: the install merges this item's rules (the registry `css` field) into your global stylesheet, in `@layer components`, and adds the lumen foundation (tokens, keyframes, motion levels) once. Nothing to import by hand.
- Re-running `add` (or `--overwrite`) re-applies those rules: put overrides in your own CSS, never in the installed rules.
- Tokens: retheme with the `--lumen-*` custom properties (`--lumen-accent`, `--lumen-accent-text`, `--lumen-bad`, `--lumen-bad-text`, `--lumen-focus`, `--lumen-good`, `--lumen-good-text`, `--lumen-hairline`, `--lumen-ink`, `--lumen-muted-ink`, `--lumen-series-1`, `--lumen-series-2`, `--lumen-series-3`, `--lumen-series-4`, `--lumen-series-5`, `--lumen-series-6`, `--lumen-warn`, `--lumen-warn-text`); this item's CSS also reads `--lumen-font-mono`, `--lumen-radius-k`. Never add Tailwind colour classes inside the component.

```tsx
import { Kbd, KbdGroup } from "@/components/ui/lumen/kbd";
```

## Parts

| Part | data-slot | What it is for |
|---|---|---|
| `Kbd` | `kbd` | One key. |
| `KbdGroup` | `kbd-group` | Keys pressed together. |

Style a part with `[data-slot="<slot>"]` selectors or its `className`; keep the attributes when editing.

## Sound
- Keep every `data-slot` and `data-sound` attribute: the sound layer reads them.
- Installing this item adds no audio. Nothing plays until the app mounts `GlassSoundProvider` once (install: `npx shadcn@latest add https://beautiful-ui.dev/r/glass-sound.json`, import from `@/components/beautiful-ui/glass-sound`); `GlassSoundToggle` is its mute control. Without a provider the audio engine never loads.

## Match the original
- Read `components/ui/lumen/kbd.tsx` as the reference implementation before changing or recreating anything, and match it: sizes, colours per theme, motion timings, copy and behaviour.
- If you deviate (a prop you can't honour, a style you changed, a dependency you swapped), say so in your reply, part by part.
- Keep the accessibility contract, the keyboard map and the motion levels listed below.

## Use it when
- kbd, keyboard shortcut, key cap, hotkey, shortcut hint, shadcn kbd, Lumen
- Showing shortcuts: help sheets, menus, tooltips, search fields
- Key sequences: KbdGroup for chords (⌘ K)

### Not when
- Code or values: use <code>

## Mistakes
- It shows a shortcut; it doesn't bind one

## Usage

```tsx
import { Kbd, KbdGroup } from "@/components/ui/lumen/kbd";

<KbdGroup><Kbd>⌘</Kbd><Kbd>K</Kbd></KbdGroup>
```

## Props

| Prop | Type | Default | What it does |
|---|---|---|---|
| `Kbd children` | `ReactNode` |  | A key: ⌘, ⇧, K, Esc… |
| `KbdGroup` | `<kbd>` |  | Keys pressed together. |

Full docs: https://beautiful-ui.dev/components/lumen-kbd

## Customising
- Colours: set the `--lumen-*` tokens on `:root`, or on a container with the `lumen-scope` class to retheme one area. Add the `lumen-inherit` class to follow your shadcn palette instead (`--chart-N`, `--destructive`).
- Dark mode follows the `.dark` class on an ancestor (the shadcn and next-themes convention).
- Update later by re-running the install with `--overwrite` (review the diff if you edited it). Changelog: https://beautiful-ui.dev/r/changelog.json

## Keyboard

| Keys | Action |
|---|---|
| — | Display only; bind the keys yourself |

## Motion inventory

| Interaction | What moves |
|---|---|
| None | Still, on purpose |

## Accessibility contract (preserve when editing)
- A native <kbd>, read as text
- Pair a symbol with its name where it matters ("⌘ Command") for screen readers

## Install

Base UI project (a base-* style in components.json):

```bash
npx shadcn@latest add https://beautiful-ui.dev/r/lumen-kbd.json
```

Radix project (a radix-*, new-york or default style):

```bash
npx shadcn@latest add https://beautiful-ui.dev/r/radix-nova/lumen-kbd.json
```

Or add the `@beautiful-ui` registry to components.json and run `npx shadcn@latest add @beautiful-ui/lumen-kbd`: the CLI picks the build from your style.

## Credits
- Built on shadcn/ui (https://ui.shadcn.com)

## Source (Base UI build)

### components/ui/lumen/kbd.tsx

```tsx
/**
 * Kbd (Lumen Halo) v1.0.0 · Beautiful UI
 * Docs: https://beautiful-ui.dev/components/lumen-kbd · Agent prompt: https://beautiful-ui.dev/md/lumen-kbd.md
 * Licensed to the purchaser under the Beautiful UI license: https://beautiful-ui.dev/license
 */
import type * as React from "react";
import { cn } from "@/lib/utils";

/* Lumen Kbd. shadcn's Kbd in Lumen Halo: the mono key cap Lumen uses in tooltips, fields and menus. */

function Kbd({ className, ...props }: React.ComponentProps<"kbd">) {
  return <kbd data-slot="kbd" className={cn(`lumen-kbd`, className)} {...props} />;
}

function KbdGroup({ className, ...props }: React.ComponentProps<"div">) {
  return <kbd data-slot="kbd-group" className={cn(`lumen-kbd-group`, className)} {...(props as React.ComponentProps<"kbd">)} />;
}

export { Kbd, KbdGroup };
```

### CSS (the registry `css` / `cssVars`, merged into the global stylesheet by the shadcn CLI)

```css
@layer components {
  .lumen-kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    box-sizing: border-box;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: calc(6px * var(--lumen-radius-k, 1));
    background: var(--gc-kbd);
    box-shadow: inset 0 -1px 0 var(--gc-hair);
    color: var(--gc-m70);
    font: 500 11px/1 var(--lumen-font-mono, var(--font-mono, var(--font-geist-mono, 'Geist Mono'))), ui-monospace, monospace;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
    pointer-events: none;
  }
  .lumen-kbd>svg {
    width: 11px;
    height: 11px;
  }
  .lumen-kbd-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    vertical-align: middle;
  }
}
```

The lumen foundation (the tokens listed above, keyframes and motion levels) installs once with the first component; its CSS is public at https://beautiful-ui.dev/r/lumen-foundation.json.
