1 GitHub star = 1 new component.

Typography typographyutilitykeyboard

KBD Key Cap

Keyboard shortcut badge with 3D keycap style.

Live Preview

KBD Key Cap

Usage

Copy and paste this code into your Astro page:

astro
---
import { KBDKeyCap } from 'astro-component-kit';
---

<KbdIndicator>Content</KbdIndicator>
--- import { KBDKeyCap } from 'astro-component-kit'; --- <KbdIndicator>Content</KbdIndicator>

Manual Installation

If you are not using the npm package, create a new file and paste the following code: src/components/lib/KBDKeyCap.astro:

astro
---
---
<kbd class="tau-kbd"><slot /></kbd>
<style>
  .tau-kbd { background: #1e293b; border: 1px solid #334155; border-bottom-width: 3px; border-radius: 6px; padding: 2px 8px; color: #f1f5f9; font-family: sans-serif; font-weight: 700; font-size: 0.75rem; display: inline-flex; align-items: center; justify-content: center; min-width: 24px; box-shadow: 0 2px 0 rgba(0,0,0,0.4); vertical-align: middle; }
</style>
--- --- <kbd class="tau-kbd"><slot /></kbd> <style> .tau-kbd { background: #1e293b; border: 1px solid #334155; border-bottom-width: 3px; border-radius: 6px; padding: 2px 8px; color: #f1f5f9; font-family: sans-serif; font-weight: 700; font-size: 0.75rem; display: inline-flex; align-items: center; justify-content: center; min-width: 24px; box-shadow: 0 2px 0 rgba(0,0,0,0.4); vertical-align: middle; } </style>

Quick Info

Category
Typography
Filename
KBDKeyCap.astro
Dependencies
None — pure Astro + CSS
Tags
typographyutilitykeyboard