Skip to content
WingoUI
ComponentsTemplatesDocsPricingAI agentsBlogChangelogContact
Components
Buttons & Actions
ButtonButton GroupCopy ButtonDelete ButtonTheme ToggleToggleToggle Group
Inputs
Avatar UploadCalendarCheckboxColor PickerComboboxCountry SelectCron PickerCurrency InputDate PickerDate Range PickerDate Time PickerDuration PickerEmail InputEmoji PickerFile UploadFilter BuilderInputInput GroupListboxMasked InputMention InputMonth PickerMulti SelectNumber InputOTP InputPassword InputPhone InputRadio GroupRatingSearch InputSegmented ControlSelectSignature PadSliderSwitchTag InputTextareaTime PickerTimezone SelectTree Select
Forms
Address InputBooking WidgetCSV ImportFieldForm WizardInline EditInvoice line itemsRich Text EditorSchema Builder
Navigation
Back To TopBounce SidebarBreadcrumbCommand MenuGlobal SearchGooey NavHook SidebarNav MenuNav TabsPaginationProximity SidebarScroll ProgressSidebarStepsTable Of ContentsTabsTopbarUser MenuWorkspace Switcher
Overlays
Alert DialogContext MenuDialogDrawerDropdown MenuFamily DrawerHover CardPopoverShare DialogSheetShortcuts DialogTooltipTour
Feedback
AlertBannerCookie ConsentEmoji ReactionEmpty StateNotification BellNotification CenterProgressRoute ProgressSetup ChecklistSkeletonSpinnerToast
Data Display
Approval FlowAvatarBadgeCalendar ViewCode BlockComment ThreadContact cardCountdownDescription ListDiff ViewerFile ListFile managerFolderGanttJSON ViewerKbdLog ViewerMarkdownPresenceSchedulerTagTimelineTree View
Tables & Lists
Audit LogData TableDeal PipelineEditable GridKanbanListMembers tablePermissions MatrixTableTask ListVirtual List
Charts & Stats
Animated CounterArea chartBar chartDonut chartFunnel chartGaugeGitHub ActivityHeatmap calendarLeaderboardLine chartRadar chartRadial barSparklineStat CardTrackerTrend badge
Layout
AccordionApp ShellCardCollapsibleDetail LayoutEntity HeaderPage HeaderScroll AreaSeparatorSettings LayoutSplit ViewToolbar
Media
Audio PlayerCarouselCSV ViewerDOCX EditorDOCX ViewerExcel ViewerFile SystemImage compareImage CropperImage GalleryImage LightboxLocation MapPDF ViewerPowerPoint ViewerQR CodeStep PlayerVideo Player
AI Kit
Agent Status CardChat MessageChat ThreadChat WidgetConversation ListFluid OrbGrid RevealMatrix OrbModel PickerPrompt InputReasoning IndicatorRule BuilderSuggestion ChipsTool Call TimelineUsage MeterVoice InputWorkflow Canvas
Text & Effects
Background PatternGravity LettersMarqueeTerminalText AnimateText Rotate
Mobile
Action SheetBottom Tab BarFABHaptic ButtonHero HeaderInstall PromptLarge Title HeaderNotification BannerOnboarding CarouselPicker WheelPull To RefreshSlide To ConfirmSticky CTA BarSwipe DeckSwipeable Tabs
Commerce
Cart drawerCategory pickerCheckout stepsCoupon inputFavorite buttonFilter panelListing cardListing gridOrder trackerPricePrice rangePricing tableProduct galleryQuantity stepperReviewsSeller card
Marketing Sections
App Download SectionBlog Cards SectionCTA SectionFAQ SectionFeature GridFeature ShowcaseHero SectionIntegrations SectionLogo CloudMarketing FooterMarketing HeaderMarketing SectionNewsletter SectionPricing SectionStats SectionSteps SectionTeam SectionTestimonials SectionTimeline SectionVideo Section
Blocks
Admin Dashboard PageAdmin ShellAI Chat PageAPI Keys PageAutomation Builder PageCheckout PageCRM Contact PageCRM Pipeline PageError PagesInbox PageInvoice PageKPI DashboardListing Detail PageLogin PageMarketplace Home PageMarketplace Search PageMarketplace ShellMobile App HomeOnboarding FlowOrder History PagePost Listing WizardPricing PageProfile PageRegister PageSettings PageUsers Admin Page
Templates
About PageAcademy PageAccessibility PageAffiliate PageAgency PageAI Product PageAppointment Booking PageBlog PageBlog Post PageBug Bounty PageCareers PageChangelog PageCommunity PageCompare PageContact PageCustomer Story PageCustomers PageDemo Booking PageDevelopers PageDocs Home PageDownload PageEnterprise PageEvents PageExperts PageFAQ PageFeature PageGlossary PageHelp Article PageHelp Center PageHome Services PageImpact PageIntegration Detail PageIntegrations PageJob Detail PageLanding PageLaunch PageLegal PageManifesto PagePortfolio PagePress PageProduct Tour PagePromo PageReal Estate PageReferral PageResearch Report PageRestaurant PageRoadmap PageROI Calculator PageSecurity PageSolutions PageStartups PageStatus PageStorefront PageSwitch PageTemplate Gallery PageTravel PageWaitlist PageYear in Review Page
Hooks & Utilities
AI ChatChart kitCommerceDate utilsFile exportFile typesFiltersForm validationHapticsInvoicingMotion presetsNavigationNumber formatRelative timeRomanian locationsSpreadsheetText matchTonesUIProvideruseClipboarduseConsentuseControllableStateuseCooldownuseDebounceuseKeyboardInsetuseLocaleuseLongPressuseMediaControlsuseMediaQueryuseOverflowItemsusePersistedStateuseScrollEdgesuseScrollStateuseSelectionuseShortcutuseStickToBottom
GalleryTheme

Data Display

Kbd

Data Display

Kbd React component for Tailwind CSS v4

JSON ViewerLog Viewer
Live props
Content
children
shortcut
separator
srLabel
Appearance
variant
size
tone
color
radius
Layout
combined
Behavior
platform
hideOnTouch
listen
Code
import { Kbd } from "@/components/ui/kbd"

<Kbd>Esc</Kbd>
  1. Home
  2. Components
  3. Data Display
  4. Kbd
Free

Kbd React component for Tailwind CSS v4

v1.0.0·Added in 1.0.0

A React kbd component for keyboard shortcuts, shown in the device's notation: ⌘K on a Mac, Ctrl+K everywhere else.

Pass a combo like mod+k and it prints ⌘ K on Apple devices and Ctrl K elsewhere; screen readers hear "Command K" instead of the glyphs. In the playground, press ⌘K (Ctrl+K) to jump into the search field, use the arrow keys and Enter to move through the results, and press Esc to close the window and again to bring it back. Turn on listen and the caps sink and light up while you hold the real keys. On a phone the keyboard hints hide themselves and a tap opens a result.

Kbd is a free React component in the React data display components category, written in TypeScript for React 19 and Tailwind CSS v4. It installs as source with npx wingo-ui@latest add kbd, together with UIProvider, useShortcut, useMediaQuery and Tones.

Add to a project

Requirements: React 19 and Tailwind CSS v4, in Next.js (App Router or Pages), Vite or React Router. Installation guide · Next.js setup · Vite setup

npx wingo-ui@latest add kbd

Usage

Import Kbd from @/components/ui/kbd.

import { Search } from "lucide-react"
import { Kbd } from "@/components/ui/kbd"

export function SearchHint() {
  return (
    <div className="flex items-center gap-2 text-sm text-muted-foreground">
      <Search className="size-4" />
      <span className="flex-1">Search listings</span>
      <Kbd shortcut="mod+k" hideOnTouch />
    </div>
  )
}

export function CloseHint() {
  return (
    <p className="text-sm text-muted-foreground">
      Press <Kbd>Esc</Kbd> to close the window, or <Kbd keys={["G", "I"]} separator="then" /> for the Inbox.
    </p>
  )
}

Props

  • childrendefault "Esc"
    ReactNode

    A single key label, used when there is no shortcut and no keys. Glyphs like ⌘ or ↵ get a spoken name for screen readers.

  • shortcutdefault ""
    string

    A combo in mod+k notation: "mod+k", "shift+mod+p", "alt+n", "mod+enter", "/". mod is ⌘ on Apple devices and Ctrl elsewhere. Wins over keys and children; an unparseable value falls back to them.

  • keys
    string[]

    One cap per entry, shown as written. For sequences (["G", "I"] with separator "then") and hints that are not one combo (["↑", "↓"]). Used when there is no shortcut.

  • separatordefault ""
    ReactNode

    Rendered between caps when they are not combined, like "+" or "then". A word separator is also read out ("G then I"); a symbol is not.

  • srLabeldefault ""
    string

    What screen readers hear instead of the caps. By default the combo is spelled out in English ("Shift Command P", "Control K", "G then I"); pass a translation on localized pages.

  • variantdefault "soft"
    "soft" | "outline" | "solid" | "ghost"

    soft is the quiet gray key for hints next to fields and buttons. outline draws a border, solid is a raised key like a real keyboard, ghost is text only for menus and inverted surfaces like tooltips.

  • sizedefault "md"
    "sm" | "md" | "lg"

    Cap height 16 / 20 / 24px with a matching minimum width, 10 / 11 / 12px type and a radius that scales along.

  • tonedefault "neutral"
    "neutral" | "brand" | "success" | "warning" | "danger" | "info"

    Semantic color. neutral is the gray key from the design system; the other tones tint the key, and a held key (listen) fills with the tone.

  • colordefault ""
    string

    Any CSS color. Replaces the tone in every variant; text on a solid key turns black or white by lightness.

  • radiusdefault "md"
    "none" | "sm" | "md" | "lg" | "full"

    Corner shape, scaled per size. md is 4 / 5 / 6px; full makes round caps.

  • combineddefault false
    boolean

    The whole combo in one cap (⌘K, Ctrl+K) instead of one cap per key. Reads well in tight rows and menus.

  • platformdefault "auto"
    "auto" | "apple" | "other"

    Forces a notation, for docs pages that show both. auto renders the Windows and Linux form on the server and during hydration, then swaps to the device's.

  • hideOnTouchdefault false
    boolean

    Hides the keys on touch screens, where a keyboard hint means nothing.

  • listendefault false
    boolean

    Caps sink and light up while the matching keys are held on a physical keyboard, and the root gets data-pressed once the whole combo is down. It only watches; it never binds or blocks a key.

  • classNames
    Partial<Record<"key" | "separator", string>>

    Extra classes for every cap (also the single cap) and for the separators.

  • className
    string

    Extra classes for the root: the <kbd> for one cap, the group span for several. Merged last.

Examples

Both notations

platform forces one: Apple glyphs next to the Windows and Linux words. auto picks the device's.

Separate caps or combined

combined puts the whole combo in one cap, handy in tight rows.

Variants and sizes

soft for hints, outline and solid for docs, ghost as plain text. 16, 20 and 24px caps.

Tones, colors and radius

The tones tint the key, color takes any CSS color, radius scales with the size.

Shortcut sheet that listens

listen: hold a combo and its caps sink, the row lights up once it is all down. A click or a tap runs it too.

Inverted and in menus

variant="ghost" plus a color class, the way tooltips and menu rows show shortcuts.

Inside buttons

As a right icon, aria-hidden with aria-keyshortcuts on the button. hideOnTouch drops the hint on phones.

Sequences

keys with a word separator ("then") for chords like G then I. The word is read out too.

Dependencies

ui-configuse-shortcutuse-media-querytones

Files

  • components/ui/kbd.tsx

FAQ

Is the React Kbd component free?

Yes. The source is free and needs no account: copy it from the Code tab or install it with the CLI.

How do I install Kbd?

Run npx wingo-ui@latest add kbd. It also adds the Wingo UI items it builds on (UIProvider, useShortcut, useMediaQuery and Tones). With shadcn, run npx shadcn@latest add https://wingo-ui.com/r/kbd.json.

How does Kbd behave on phones?

On a phone the keyboard hints hide themselves and a tap opens a result.

See also

TooltipShortcuts DialogCommand MenuuseShortcuthookuseMediaQueryhook

Used in

TooltipSidebarFilter panelSearch InputInline EditCommand MenuGlobal SearchShortcuts DialogTourComment ThreadSettings LayoutDOCX Editor

and 10 more.

More React data display components

BadgeFile managerCountdownApproval FlowAvatarCalendar View
All 23 React data display components

Articles using this component

  • React Command Palette: Cmd+K, Nested Pages and Mobile

    Component guides · Oct 9, 2026 · 9 min read

PreviousJSON ViewerNext Log Viewer

Recent

  • 2-bedroom apartmentBrooklyn · $3,200 / mo
  • City bikePortland · $280
  • 14 inch laptopNew York · $690
↑↓Up arrow Down arrownavigateEnterEnteropenTap a listing to open it

Press EscEscape to close the window

Windows and Linux notation, detected from this device