Dither / components
Kbd
Keyboard keys and shortcuts, in mono.
- Stable
- 1 variants
- 1 props
- Light & Dark
light
K
Press Esc to close, CtrlEnter to send.
dark
K
Press Esc to close, CtrlEnter to send.
Code
import { CommandIcon } from "@hugeicons/core-free-icons";import { Icon } from "@/lib/icon";import { Kbd, KbdGroup } from "@/components/ui/kbd";export default function KbdDemo() { return ( <div className="flex flex-col items-center gap-3 text-sm text-muted-foreground"> <KbdGroup> <Kbd><Icon icon={CommandIcon} /></Kbd> <Kbd>K</Kbd> </KbdGroup> <p> Press <Kbd>Esc</Kbd> to close, <KbdGroup><Kbd>Ctrl</Kbd><Kbd>Enter</Kbd></KbdGroup> to send. </p> </div> );}Installation
npx shadcn add @dither/kbdUsage
import { Kbd, KbdGroup } from "@/components/ui/kbd";
<KbdGroup><Kbd>⌘</Kbd><Kbd>K</Kbd></KbdGroup>Props
Prop
Type
Examples
In a button
Inside a primary button, Kbd turns translucent on the dark fill.
light
dark
Code
import { ArrowRight02Icon, SentIcon } from "@hugeicons/core-free-icons";import { Icon } from "@/lib/icon";import { Button } from "@/components/ui/button";import { Kbd, KbdGroup } from "@/components/ui/kbd";export default function ButtonStates() { return ( <div className="flex flex-wrap items-center justify-center gap-2"> <Button variant="outline"> <Icon icon={SentIcon} /> Send </Button> <Button variant="outline"> Learn more <Icon icon={ArrowRight02Icon} /> </Button> <Button loading>Please wait</Button> <Button disabled>Disabled</Button> <Button> Save <KbdGroup> <Kbd>⌘</Kbd> <Kbd>S</Kbd> </KbdGroup> </Button> </div> );}