Skip to content
Klarhimmel UI

Press ⌘ K to search.

npx shadcn add @klarhimmel/kbd
DetailsAbout, usage, props and more

A keyboard key, for shortcuts in text and menus.

When to use

  • Use for

    Keyboard shortcuts in text and menus.

  • Not for

    Decoration.

  • Pairs with

    Search triggers, help text.

Preview

  • Search the rooms: ⌘ K
  • New booking: N
  • Close anything open: Esc
kbd.tsx
import { Theme } from '@/components/klarhimmel/theme/style';
import { Kbd } from '@/components/klarhimmel/ui/kbd';

export default function Example() {
  return (
    <Theme theme="brand">
      <p>Press <Kbd>⌘</Kbd> <Kbd>K</Kbd> to search.</p>
    </Theme>
  );
}

Import

Import

import { Kbd } from '@/components/klarhimmel/ui/kbd';
Files
kbd.tsx, in components/klarhimmel/ui/. With it: theme, utils.
Render in
Render it inside <Theme>, once near the root of your app. Tokens and fonts are scoped to it, so outside it the component is unstyled.

Props

PropTypeDefaultDescription
childrenReactNoderequiredRequired. The key.
classNamestring-Extra classes, merged after the component's own.

Accessibility

KeyDoes
TabSkips it: Kbd only displays a key

Screen readers read the key as text. Write what it does next to it.

Accessibility