Kbd
Keyboard shortcuts
Save
⌘+S
Undo
⌘+Z
Redo
⇧+⌘+Z
Command palette
⌘+K
Toggle comment
⌘+/
Kbd
Keyboard shortcut display component for help cards, tooltips, and command palettes.
Import
use maud_ui::primitives::kbd::{self, Props};
Example
use maud::html;
use maud_ui::primitives::kbd;
html! {
(kbd::render(kbd::Props {
keys: vec!["⌘".to_string(), "K".to_string()],
}))
}
Props
| Field | Type | Default | Description |
|---|---|---|---|
keys | Vec<String> | vec![] | Sequence of key labels (e.g., ["Ctrl", "S"] or ["⌘", "K"]). |
Rendering
- Each key renders as a
<kbd>element. - Keys are separated by
+(span.mui-kbd-separator). - Container wraps in
div.mui-kbd-containerfor flexbox layout.
Accessibility
- Uses semantic
<kbd>element for keyboard input notation. - Screen readers will announce as "Ctrl plus S" etc. (based on platform-specific SR rendering).
- No ARIA labels needed; semantic markup is sufficient.
Related
Shadcn Reference
Minimal kbd component for keyboard notation. Typically embedded in help dialogs or command palette documentation.