Components
Used to display textual user input from keyboard.
Playground
<kbd> element sized to a 20px keycap — it is pointer-events-none and select-none, so it reads as annotation rather than a control.import { Kbd, KbdGroup } from "@workspace/ui/components/kbd"
<Kbd>Ctrl</Kbd><kbd> for assistive technology.<KbdGroup> <Kbd>⌘</Kbd> <Kbd>⇧</Kbd> <Kbd>⌥</Kbd> <Kbd>⌃</Kbd> </KbdGroup>
<KbdGroup> <Kbd>Ctrl</Kbd> <span>+</span> <Kbd>B</Kbd> </KbdGroup> <KbdGroup> <Kbd>⌘</Kbd> <span>then</span> <Kbd>P</Kbd> </KbdGroup>
data-icon="inline-end" so the button tightens its end padding, exactly as it does for trailing icons.<Button variant="outline" size="sm"> Accept <Kbd data-icon="inline-end">⏎</Kbd> </Button> <Button variant="outline" size="sm"> Cancel <Kbd data-icon="inline-end">Esc</Kbd> </Button>
in-data-[slot=tooltip-content]:bg-background/20 swaps the muted fill for a translucent one that works on the inverted tooltip surface. Hover the button to see it.<Tooltip>
<TooltipTrigger asChild>
<Button variant="outline" size="sm">
Save
</Button>
</TooltipTrigger>
<TooltipContent>
Save changes
<KbdGroup>
<Kbd>⌘</Kbd>
<Kbd>S</Kbd>
</KbdGroup>
</TooltipContent>
</Tooltip><InputGroup>
<InputGroupInput placeholder="Search…" />
<InputGroupAddon align="inline-end">
<Kbd>⌘</Kbd>
<Kbd>K</Kbd>
</InputGroupAddon>
</InputGroup><div dir="rtl">
حفظ
<KbdGroup>
<Kbd>Ctrl</Kbd>
<span>+</span>
<Kbd>S</Kbd>
</KbdGroup>
</div><kbd> element and accept every HTML attribute. There are no variants — restyle via className, or target data-slot="kbd" from a parent, as TooltipContent and Button do.| Component | Prop | Default |
|---|---|---|
| Kbd | className?: string | — |
| KbdGroup | className?: string | — |
<Kbd data-slot="kbd">⌘</Kbd> <KbdGroup data-slot="kbd-group">…</KbdGroup>
Tokens used
7 design tokens consumed by the Kbd component.
--muted
Muted
--muted-foreground
Muted Foreground
--background
Background
--font-sans
Font Sans (Inter)
--text-xs
Text Extra Small (12px)
--radius-sm
Radius 0.6× (6px)
--spacing
Spacing unit (4px)