1. Documentation
  2. Typography
  3. Kbd
ReadmenpmGitHub
  • Introduction
  • Installation
  • Theming
  • Icons
  • Accordion
  • Card
  • Scroll Area
  • Separator
  • Sidebar
  • Field
  • Label
  • Input
  • Textarea
  • Number Field
  • OTP Field
  • Select
  • Combobox
  • Checkbox
  • Radio
  • Switch
  • Slider
  • Toggle
  • Calendar
  • Date Picker
  • File Upload
  • Button
  • Copy Button
  • Dropdown
  • Command
  • Tabs
  • Breadcrumb
  • Pagination
  • Tree
  • Table
  • Data Table
  • Stat
  • Timeline
  • Avatar
  • Status Bar
  • Badge
  • Meter
  • Empty
  • Skeleton
  • Spinner
  • Toast
  • Dialog
  • Sheet
  • Popover
  • Tooltip
  • Text
  • Kbd
  • Code Block
  • Utilities
  • Design rules

Kbd

A keyboard key — the one place heyo-ui leans on monospace type.

Loading documentation…

Text< PreviousCode BlockNext >

Powered by heyo

On this page

UsageIn a menuSeparatorsPropertiesKbdKbd.Group
⌘⌘KGthenD
<Kbd>⌘</Kbd><Kbd.Group><Kbd>⌘</Kbd><Kbd>K</Kbd></Kbd.Group><Kbd.Group separator="then"><Kbd>G</Kbd><Kbd>D</Kbd></Kbd.Group>

Kbd renders a <kbd> as a keycap: monospaced and hairlined. It is the single place where heyo-ui leans on mono type, because keycaps read better that way.

Usage

tsx
import { Kbd } from "@heyo-sh/heyo-ui";<Kbd.Group>  <Kbd>⌘</Kbd>  <Kbd>K</Kbd></Kbd.Group>;

In a menu

The usual home for a shortcut hint is the right end of a row — a Dropdown.Item or a Command result.

<Dropdown><Dropdown.Trigger render={<Button>File</Button>} /><Dropdown.Content>  <Dropdown.Item shortcut={<Kbd.Group><Kbd>⌘</Kbd><Kbd>S</Kbd></Kbd.Group>}>Save</Dropdown.Item>  <Dropdown.Item shortcut={<Kbd>R</Kbd>}>Rename</Dropdown.Item></Dropdown.Content></Dropdown>
Platform-aware shortcuts

Command.Shortcut spells "mod+k" as ⌘K on macOS and Ctrl K everywhere else, using these same keycaps. Prefer it over hard-coding a ⌘.

Separators

separator is empty by default, which gives the tight ⌘K form. Pass a character or a word for a sequence.

Ctrl+⇧+PGthenI
<Kbd.Group separator="+"><Kbd>Ctrl</Kbd><Kbd>⇧</Kbd><Kbd>P</Kbd></Kbd.Group><Kbd.Group separator="then"><Kbd>G</Kbd><Kbd>I</Kbd></Kbd.Group>

Properties

Kbd

childrenReactNodeoptional

The key. One glyph or one short word.

classNamestringoptional

Merged into the <kbd>.

Kbd.Group

separatorstringoptional

The character rendered between keys. It defaults to "", which gives the tight ⌘K form.

childrenReactNodeoptional

The keys.