Components
Kbd
Keyboard shortcut chip and chord group.
Composition
Keyboard chord
- <KbdGroup>
- <Kbd />
Installation
The Control UI source installs this component from src/registry/sources/control-ui/ui/kbd.tsx.
npx shadcn@latest add https://control-ui.dev/r/kbd.jsonRaw code
Primary installed source
import type { ComponentProps, CSSProperties } from "react";
import type { KbdKnobStyle } from "@/components/control-ui/knob-contracts/kbd-knobs";import { cn } from "@/components/control-ui/lib/cn";
export const kbdVariants = ["default", "ghost"] as const;
export type KbdVariant = (typeof kbdVariants)[number];
export type KbdProps = Omit<ComponentProps<"kbd">, "style"> & { variant?: KbdVariant; style?: CSSProperties & KbdKnobStyle };
export function Kbd({ variant = "default", className, ...props }: KbdProps) { return ( <kbd data-control-ui="kbd" data-control-family="kbd" data-slot="root" data-variant={variant} className={cn("inline-flex select-none items-center justify-center", className)} {...props} /> );}
export type KbdGroupProps = Omit<ComponentProps<"span">, "style"> & { style?: CSSProperties & KbdKnobStyle };
export function KbdGroup({ className, ...props }: KbdGroupProps) { return ( <span data-control-ui="kbd" data-control-family="kbd" data-slot="group" className={cn("inline-flex items-center", className)} {...props} /> );}
Knobs
Typed custom properties the recipe paints with. Set one on the root — style, a utility class, or a skin — and every slot inherits it.
| Knob | Syntax | Default |
|---|---|---|
--cui-kbd-radius | <length-percentage> | var(--radius-control) |
--cui-kbd-background | <color> | oklch(from var(--card) l c h / 0.6) |
--cui-kbd-foreground | <color> | var(--muted-foreground) |
--cui-kbd-border-color | <color> | var(--control-rim) |
--cui-kbd-shadow | * | var(--shadow-sm) |
--cui-kbd-padding-inline | <length-percentage> | calc(var(--spacing) * 1.5) |
--cui-kbd-font-size | <length-percentage> | var(--text-micro) |
--cui-kbd-font-weight | <number> | var(--font-weight-medium) |