120k

Kbd

Used to display textual user input from keyboard.

Installation

pnpm dlx shadcn@latest add @force-ui-vue/kbd

Usage

<script setup lang="ts">
import { Kbd } from "@/components/ui/kbd"
</script>
 
<template>
  <Kbd>Ctrl</Kbd>
</template>

Composition

Use the following composition to build Kbd and KbdGroup:

Kbd
KbdGroup
├── Kbd
└── Kbd

Examples

Group

Use the KbdGroup component to group keyboard keys together.

Button

Use the Kbd component inside a Button component to display a keyboard key inside a button.

Tooltip

You can use the Kbd component inside a Tooltip component to display a tooltip with a keyboard key.

Input Group

You can use the Kbd component inside a InputGroupAddon component to display a keyboard key inside an input group.

Primary

Use variant="primary" when placing a Kbd on a solid or brand-coloured surface so the key label remains legible against the background.

RTL

To enable RTL support in Force UI, see the RTL configuration guide.

API Reference

Kbd

Use the Kbd component to display a keyboard key.

PropTypeDefault
classstring``
variant"default" | "primary""default"
<Kbd>Ctrl</Kbd>

KbdGroup

Use the KbdGroup component to group Kbd components together.

PropTypeDefault
classstring``
<KbdGroup>
  <Kbd>Ctrl</Kbd>
  <Kbd>B</Kbd>
</KbdGroup>