Kbd
Shows the name of a keyboard key, like Ctrl or Enter, drawn as a physical keycap.
<arc-kbd>Overview
Kbd shows a keyboard key, styled like a keycap, inline in running text. Use it to document shortcuts and key combinations. It renders a semantic <kbd> element and takes any content in its default slot: a single key like "Ctrl", a modifier or a special character.
Guidelines
Do
- Use one Kbd per key, joined with "+" or other separator text
- Use standard key names: Ctrl, Shift, Alt, Cmd, Enter, Esc, Tab
Don't
- Don't use it for mouse actions or touch gestures
- Don't put words or long strings in a Kbd
- Don't style it to look like a button. It isn't interactive
- Don't use it for code. Use CodeBlock
Features
- Keycap look: a `--surface-overlay` background and a 1px `--border-default` border with a 2px bottom edge
- Monospace text (`--font-mono`) at the small text size (`--text-sm`)
- `user-select: none`, so a key isn't caught up when someone selects the surrounding text
Preview
Press
Usage
Press <arc-kbd>Ctrl</arc-kbd> + <arc-kbd>C</arc-kbd> to copy.import { Kbd } from '@arclux/arc-ui-react';
Press <Kbd>Ctrl</Kbd> + <Kbd>C</Kbd> to copy.<script setup>
import { Kbd } from '@arclux/arc-ui-vue';
</script>
<template>
Press <Kbd>Ctrl</Kbd> + <Kbd>C</Kbd> to copy.
</template><script>
import { Kbd } from '@arclux/arc-ui-svelte';
</script>
Press <Kbd>Ctrl</Kbd> + <Kbd>C</Kbd> to copy.import { Component } from '@angular/core';
import { Kbd } from '@arclux/arc-ui-angular';
@Component({
imports: [Kbd],
template: `
Press <arc-kbd>Ctrl</arc-kbd> + <arc-kbd>C</arc-kbd> to copy.
`,
})
export class MyComponent {}import { Kbd } from '@arclux/arc-ui-solid';
Press <Kbd>Ctrl</Kbd> + <Kbd>C</Kbd> to copy.import { Kbd } from '@arclux/arc-ui-preact';
Press <Kbd>Ctrl</Kbd> + <Kbd>C</Kbd> to copy.<!-- Auto-generated by @arclux/prism — do not edit manually -->
<!-- arc-kbd — requires kbd.css + base.css (or arc-ui.css) -->
<span class="arc-kbd">
<kbd class="kbd">Kbd</kbd>
</span><!-- Auto-generated by @arclux/prism — do not edit manually -->
<!-- arc-kbd — self-contained, no external CSS needed -->
<span class="arc-kbd" style="display: inline">
<kbd style="display: inline-flex; align-items: center; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 11px; line-height: 1; color: rgb(138, 138, 150); background: rgb(17, 17, 22); border: 1px solid rgb(34, 34, 41); border-bottom-width: 2px; border-radius: 4px; padding: 2px 6px; white-space: nowrap; user-select: none; vertical-align: baseline">Kbd</kbd>
</span>