Kbd

free

Kbd renders compact keyboard hints for shortcuts, menus, and command footers.

Navigate: UpDown
Select: Enter
Close: Esc
import Kbd from '@/components/ui/kbd';

export default function UsageDemo() {
  return (

Installation

Add this component with the NateUI CLI.

npx nateui@latest add Kbd

Examples

Basic

EscTabEnter⌘K
import Kbd from '@/components/ui/kbd';

export default function BasicDemo() {
  return (

Combinations

Open command menuCtrl+K
Save changesCtrl+S
import Kbd from '@/components/ui/kbd';

export default function CombinationsDemo() {
  return (

Icon Content

Esc
import { PiArrowElbowDownLeft, PiCommand } from 'react-icons/pi'
import Kbd from '@/components/ui/kbd';

export default function IconContentDemo() {

Custom Class

escSpaceF
import Kbd from '@/components/ui/kbd';

export default function CustomClassDemo() {
  return (

API

Kbd renders a native kbd element. String children receive the component's monospace key-label treatment.

PropDescriptionTypeDefault
childrenKey label or custom node rendered inside the keycap.ReactNode-
classNameAdditional classes appended to the keycap.string-
...nativeKbdPropsNative props for the underlying kbd element.NativeKbdProps-

Types

type NativeKbdProps = ComponentProps<'kbd'>;