|
| 1 | +# Keyboard shortcuts |
| 2 | + |
| 3 | +You can represent keyboard keys and shortcuts in your documentation using the `{kbd}` role. This is useful for showing keyboard commands and shortcuts in a visually consistent way. |
| 4 | + |
| 5 | +## Basic usage |
| 6 | + |
| 7 | +To display a keyboard key, use the syntax `` {kbd}`key-name` ``. For example, writing `` {kbd}`Enter` `` will render as a styled keyboard key. |
| 8 | + |
| 9 | +::::{tab-set} |
| 10 | + |
| 11 | +:::{tab-item} Output |
| 12 | +Press {kbd}`Enter` to submit. |
| 13 | +::: |
| 14 | + |
| 15 | +:::{tab-item} Markdown |
| 16 | +```markdown |
| 17 | +Press {kbd}`Enter` to submit. |
| 18 | +``` |
| 19 | +::: |
| 20 | + |
| 21 | +:::: |
| 22 | + |
| 23 | +## Keyboard combinations |
| 24 | + |
| 25 | +You can represent keyboard combinations by joining multiple `{kbd}` roles with a plus sign (+). |
| 26 | + |
| 27 | +::::{tab-set} |
| 28 | + |
| 29 | +:::{tab-item} Output |
| 30 | +{kbd}`ctrl` + {kbd}`C` to copy text. |
| 31 | + |
| 32 | +{kbd}`Shift` + {kbd}`Alt` + {kbd}`F` to format the document. |
| 33 | +::: |
| 34 | + |
| 35 | +:::{tab-item} Markdown |
| 36 | +```markdown |
| 37 | +{kbd}`Ctrl` + {kbd}`C` to copy text. |
| 38 | + |
| 39 | +{kbd}`Shift` + {kbd}`Alt` + {kbd}`F` to format the document. |
| 40 | +``` |
| 41 | +::: |
| 42 | + |
| 43 | +:::: |
| 44 | + |
| 45 | +## Common shortcuts by platform |
| 46 | + |
| 47 | +Here are some common keyboard shortcuts across different platforms: |
| 48 | + |
| 49 | +::::{tab-set} |
| 50 | + |
| 51 | +:::{tab-item} Output |
| 52 | +| Mac | Windows/Linux | Description | |
| 53 | +|-------------------------|----------------------------|-----------------------------| |
| 54 | +| {kbd}`⌘` + {kbd}`C` | {kbd}`Ctrl` + {kbd}`C` | Copy | |
| 55 | +| {kbd}`⌘` + {kbd}`V` | {kbd}`Ctrl` + {kbd}`V` | Paste | |
| 56 | +| {kbd}`⌘` + {kbd}`Z` | {kbd}`Ctrl` + {kbd}`Z` | Undo | |
| 57 | +| {kbd}`⌘` + {kbd}`Enter` | {kbd}`Ctrl` + {kbd}`Enter` | Run a query | |
| 58 | +| {kbd}`⌘` + {kbd}`/` | {kbd}`Ctrl` + {kbd}`/` | Comment or uncomment a line | |
| 59 | +::: |
| 60 | + |
| 61 | +:::{tab-item} Markdown |
| 62 | +```markdown |
| 63 | +| Mac | Windows/Linux | Description | |
| 64 | +|-------------------------|----------------------------|-----------------------------| |
| 65 | +| {kbd}`⌘` + {kbd}`C` | {kbd}`Ctrl` + {kbd}`C` | Copy | |
| 66 | +| {kbd}`⌘` + {kbd}`V` | {kbd}`Ctrl` + {kbd}`V` | Paste | |
| 67 | +| {kbd}`⌘` + {kbd}`Z` | {kbd}`Ctrl` + {kbd}`Z` | Undo | |
| 68 | +| {kbd}`⌘` + {kbd}`Enter` | {kbd}`Ctrl` + {kbd}`Enter` | Run a query | |
| 69 | +| {kbd}`⌘` + {kbd}`/` | {kbd}`Ctrl` + {kbd}`/` | Comment or uncomment a line | |
| 70 | +``` |
| 71 | +::: |
| 72 | + |
| 73 | +:::: |
| 74 | + |
| 75 | +## Special keys |
| 76 | + |
| 77 | +Some commonly used special keys: |
| 78 | + |
| 79 | +::::{tab-set} |
| 80 | + |
| 81 | +:::{tab-item} Output |
| 82 | +| Symbol | Key Description | |
| 83 | +|-----------|------------------| |
| 84 | +| {kbd}`⌘` | Command (Mac) | |
| 85 | +| {kbd}`⌥` | Option/Alt (Mac) | |
| 86 | +| {kbd}`⇧` | Shift | |
| 87 | +| {kbd}`⌃` | Control | |
| 88 | +| {kbd}`↩` | Return/Enter | |
| 89 | +| {kbd}`⌫` | Delete/Backspace | |
| 90 | +| {kbd}`⇥` | Tab | |
| 91 | +| {kbd}`↑` | Up Arrow | |
| 92 | +| {kbd}`↓` | Down Arrow | |
| 93 | +| {kbd}`←` | Left Arrow | |
| 94 | +| {kbd}`→` | Right Arrow | |
| 95 | +| {kbd}`⎋` | Escape | |
| 96 | +::: |
| 97 | + |
| 98 | +:::{tab-item} Markdown |
| 99 | +```markdown |
| 100 | +| Symbol | Key Description | |
| 101 | +|-----------|------------------| |
| 102 | +| {kbd}`⌘` | Command (Mac) | |
| 103 | +| {kbd}`⌥` | Option/Alt (Mac) | |
| 104 | +| {kbd}`⇧` | Shift | |
| 105 | +| {kbd}`⌃` | Control | |
| 106 | +| {kbd}`↩` | Return/Enter | |
| 107 | +| {kbd}`⌫` | Delete/Backspace | |
| 108 | +| {kbd}`⇥` | Tab | |
| 109 | +| {kbd}`↑` | Up Arrow | |
| 110 | +| {kbd}`↓` | Down Arrow | |
| 111 | +| {kbd}`←` | Left Arrow | |
| 112 | +| {kbd}`→` | Right Arrow | |
| 113 | +| {kbd}`⎋` | Escape | |
| 114 | +``` |
| 115 | +::: |
| 116 | + |
| 117 | +:::: |
0 commit comments