Kbd

New

Display a keyboard key or a shortcut.

Preview ​

Installation ​

npx sigma-ui@latest add kbd

Usage ​

vue
<script setup lang="ts">
import { Kbd, KbdGroup } from '@/components/ui/kbd';
</script>

<template>
  <KbdGroup>
    <Kbd>Ctrl</Kbd>
    <Kbd>B</Kbd>
  </KbdGroup>
</template>

Group keys that belong to one shortcut with KbdGroup. Inside a tooltip, the key uses a lighter background so it stays readable on the inverted surface.

Examples ​

Shortcut ​

API Reference ​

Kbd ​

Slots

SlotScope
default

Key label, such as Ctrl or an icon.

-

KbdGroup ​

Slots

SlotScope
default

Kbd elements that form one shortcut.

-

Accessibility ​

Kbd renders a native <kbd> element, which assistive technologies announce as a keyboard input. The keys are not interactive.

KeyDescription
TabMoves focus past the shortcut. The keys themselves are not focusable.
Edit this page on GitHub