Kbd

@sushindustries/ui

A key, drawn as one. Semantically <kbd>, visually the chip the command palette already wears.

4 min read
View as MarkdownEdit on GitHub

A single keyboard key, rendered as the semantic <kbd> element and styled as the chip the command palette already wears. Reach for it anywhere prose or a tooltip needs to show a key someone can press.

Viewport width
Phone22remthe floor, the narrowest this promises to work at
tanstacktanstack add https://adamjurek.com/r/tanstack/kbd.jsonshadcnpnpm dlx shadcn@latest add https://adamjurek.com/r/shadcn/kbd.json

Why it is built this way

The command palette already drew this chip for its own shortcuts, so KbdKbdA key, drawn as one. Semantically <kbd>, visually the chip the command palette already wears.@sushindustries/ui · content exists to be that one shape for "press this" everywhere it appears, rather than a border and a background reinvented per page.

What it does not do

It holds one key, not a chord. ⌘K is two <Kbd> elements joined by plain text or a +, not one <Kbd> wrapping both characters - the chip shape was drawn for a single press, and a chord inside it reads as one press instead of two.

Install commands are not written here

Anything in packages/ui/registry.ts gets its TanStack and shadcn commands attached automatically, so there is nothing to keep in sync.

Install

tanstack add https://adamjurek.com/r/tanstack/kbd.json
shell
pnpm dlx shadcn@latest add https://adamjurek.com/r/shadcn/kbd.json
shell
pnpm add @sushindustries/ui @sushindustries/atoms
shell

What you get

Version0.1.0
Categorycontent · Text
Fileskbd.tsx
DependenciesNone
Tagskeyboard, no-deps

No runtime dependencies

It brings nothing with it beyond the stylesheet.