Componentnavigation0.26 KB gzipZero dependencies

Kbd

Keycap indicator with raised bottom border for shortcuts.

Preview

Live Preview
Open ↗

Installation

Tokens guide →

Add to your project via CLI (zero dependencies, code you own):

npx bigbullui add kbd

Or install the full npm package:

npm install bigbullui

Usage

tsx3 lines
import { Kbd } from "@/components/ui/kbd"; <Kbd>⌘</Kbd> + <Kbd>K</Kbd>

Source code

kbd.tsx + 1 helper

Zero third-party dependencies (2 local files shown in tabs below).

tsxkbd.tsx22 lines
import * as React from "react";import { cn } from "./lib/utils"; export interface KbdProps extends React.HTMLAttributes<HTMLElement> {  children?: React.ReactNode;  className?: string;} export function Kbd({ children, className, ...props }: KbdProps) {  return (    <kbd      className={cn(        "inline-flex items-center justify-center rounded-sm border border-border border-b-2 border-b-foreground/30 bg-secondary px-1.5 py-0.5 font-mono text-[11px] font-semibold text-secondary-foreground shadow-xs",        className      )}      {...props}    >      {children}    </kbd>  );} 

Props

PropTypeDescription
childrenReact.ReactNodeChild elements rendered inside the component.
classNamestringOptional Tailwind or custom CSS classes merged with component styles.