Kbd
The Kbd component is used to display which key or combination of keys performs a given action.
When To Use
- Used for recognizing keyboard inputs by means of a visual key representation.
- When displaying keyboard shortcuts to users.
Example Usage
Use the component to represent keys or combinations.
Press ⌘ + C to copy.
astro
---
import Kbd from '@/components/data-display/Kbd.astro';
---
<p>
Press <span class="flex gap-1 items-center"><Kbd>⌘</Kbd> + <Kbd>C</Kbd></span> to copy.
</p> Variants
Sizes
The Kbd component supports different sizes: `sm`, `md`, and `lg`.
Ctrl Ctrl Ctrl
astro
<Kbd size="sm">Ctrl</Kbd>
<Kbd size="md">Ctrl</Kbd>
<Kbd size="lg">Ctrl</Kbd> Intents
The Kbd component supports different visual intents: `default`, `outline`, and `ghost`.
Default Outline Ghost
astro
<Kbd intent="default">Default</Kbd>
<Kbd intent="outline">Outline</Kbd>
<Kbd intent="ghost">Ghost</Kbd> API Reference
| Property | Description | Type | Default |
|---|---|---|---|
| size | Size of the keyboard key. | 'sm' | 'md' | 'lg' | 'md' |
| intent | Visual style of the keyboard key. | 'default' | 'outline' | 'ghost' | 'default' |
| class | Additional CSS classes to apply. | string | - |