2025-10-30 10:03:34 +07:00
|
|
|
---
|
2026-06-03 23:08:41 +08:00
|
|
|
templateEngineOverride: njk
|
2025-10-30 10:03:34 +07:00
|
|
|
layout: layouts/page.njk
|
|
|
|
|
title: Kbd
|
|
|
|
|
description: Used to display textual user input from keyboard.
|
|
|
|
|
toc:
|
|
|
|
|
- label: Usage
|
|
|
|
|
id: usage
|
|
|
|
|
- label: Examples
|
|
|
|
|
id: examples
|
|
|
|
|
children:
|
|
|
|
|
- label: Group
|
|
|
|
|
id: example-group
|
|
|
|
|
- label: Button
|
|
|
|
|
id: example-button
|
2026-06-03 18:59:21 +08:00
|
|
|
- label: Input Group
|
|
|
|
|
id: example-input-group
|
|
|
|
|
- label: RTL
|
|
|
|
|
id: example-rtl
|
2025-10-30 10:03:34 +07:00
|
|
|
---
|
|
|
|
|
|
|
|
|
|
{% from "macros/code_preview.njk" import code_preview %}
|
|
|
|
|
{% from "macros/code_block.njk" import code_block %}
|
|
|
|
|
|
|
|
|
|
{% set code_html %}
|
|
|
|
|
<div class="flex flex-col items-center gap-4">
|
2026-06-03 18:59:21 +08:00
|
|
|
<span class="kbd-group">
|
2025-11-03 13:51:40 +08:00
|
|
|
<kbd class="kbd">⌘</kbd>
|
|
|
|
|
<kbd class="kbd">⇧</kbd>
|
|
|
|
|
<kbd class="kbd">⌥</kbd>
|
|
|
|
|
<kbd class="kbd">⌃</kbd>
|
2025-10-30 10:03:34 +07:00
|
|
|
</span>
|
2026-06-03 18:59:21 +08:00
|
|
|
<span class="kbd-group">
|
2025-11-03 13:51:40 +08:00
|
|
|
<kbd class="kbd">Ctrl</kbd>
|
2025-10-30 10:03:34 +07:00
|
|
|
<span>+</span>
|
2025-11-03 13:51:40 +08:00
|
|
|
<kbd class="kbd">B</kbd>
|
2025-10-30 10:03:34 +07:00
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
{% endset %}
|
|
|
|
|
|
|
|
|
|
{{ code_preview("kbd", code_html | prettyHtml) }}
|
|
|
|
|
|
|
|
|
|
<h2 id="usage"><a href="#usage">Usage</a></h2>
|
|
|
|
|
|
2025-11-02 11:56:40 +08:00
|
|
|
<section class="prose">
|
2026-06-03 18:59:21 +08:00
|
|
|
<p>Use the <code><kbd></code> element with the <code>kbd</code> class. Use <code>kbd-group</code> to group multiple keys.</p>
|
2025-11-02 11:56:40 +08:00
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
{% set code_simple %}
|
2025-11-03 13:51:40 +08:00
|
|
|
<kbd class="kbd">⌘K</kbd>
|
2025-11-02 11:56:40 +08:00
|
|
|
{% endset %}
|
|
|
|
|
|
|
|
|
|
{{ code_block(code_simple | prettyHtml, "html") }}
|
2025-10-30 10:03:34 +07:00
|
|
|
|
|
|
|
|
<h2 id="examples"><a href="#examples">Examples</a></h2>
|
|
|
|
|
|
|
|
|
|
<h3 id="example-group"><a href="#example-group">Group</a></h3>
|
|
|
|
|
|
|
|
|
|
{% set group_html %}
|
|
|
|
|
<p class="text-muted-foreground text-sm">
|
|
|
|
|
Use
|
2026-06-03 18:59:21 +08:00
|
|
|
<span class="kbd-group">
|
2025-11-03 13:51:40 +08:00
|
|
|
<kbd class="kbd">Ctrl + B</kbd>
|
|
|
|
|
<kbd class="kbd">Ctrl + K</kbd>
|
2025-10-30 10:03:34 +07:00
|
|
|
</span>
|
|
|
|
|
to open the command palette
|
|
|
|
|
</p>
|
|
|
|
|
{% endset %}
|
|
|
|
|
|
|
|
|
|
{{ code_preview("kbd-group", group_html | prettyHtml) }}
|
|
|
|
|
|
|
|
|
|
<h3 id="example-button"><a href="#example-button">Button</a></h3>
|
|
|
|
|
|
|
|
|
|
{% set button_html %}
|
|
|
|
|
<div class="flex flex-wrap items-center gap-x-4">
|
2026-06-03 18:59:21 +08:00
|
|
|
<button class="btn-sm-outline pe-2">Accept <kbd class="kbd">⏎</kbd></button>
|
|
|
|
|
<button class="btn-sm-outline pe-2">Cancel <kbd class="kbd">Esc</kbd></button>
|
2025-10-30 10:03:34 +07:00
|
|
|
</div>
|
|
|
|
|
{% endset %}
|
|
|
|
|
|
2026-06-03 18:59:21 +08:00
|
|
|
{{ code_preview("kbd-button", button_html | prettyHtml) }}
|
|
|
|
|
|
|
|
|
|
<h3 id="example-input-group"><a href="#example-input-group">Input Group</a></h3>
|
|
|
|
|
|
|
|
|
|
{% set input_group_html %}
|
|
|
|
|
<div class="relative w-full max-w-sm">
|
|
|
|
|
<input type="search" class="input ps-9 pe-12" placeholder="Search...">
|
|
|
|
|
{% lucide "search", { "class": "absolute start-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground" } %}
|
|
|
|
|
<kbd class="kbd absolute end-3 top-1/2 -translate-y-1/2">/</kbd>
|
|
|
|
|
</div>
|
|
|
|
|
{% endset %}
|
|
|
|
|
|
|
|
|
|
{{ code_preview("kbd-input-group", input_group_html | prettyHtml) }}
|
|
|
|
|
|
|
|
|
|
<h3 id="example-rtl"><a href="#example-rtl">RTL</a></h3>
|
|
|
|
|
|
|
|
|
|
<section class="prose">
|
|
|
|
|
<p>Keyboard labels are direction-neutral. Surrounding spacing should use logical utilities when position matters.</p>
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
{% set rtl_html %}
|
|
|
|
|
<p dir="rtl" class="text-muted-foreground text-sm">
|
|
|
|
|
استخدم
|
|
|
|
|
<span class="kbd-group">
|
|
|
|
|
<kbd class="kbd">Ctrl</kbd>
|
|
|
|
|
<kbd class="kbd">K</kbd>
|
|
|
|
|
</span>
|
|
|
|
|
لفتح البحث
|
|
|
|
|
</p>
|
|
|
|
|
{% endset %}
|
|
|
|
|
|
|
|
|
|
{{ code_preview("kbd-rtl", rtl_html | prettyHtml) }}
|