kbd: Add KbdGroup component.#2313
Open
elcoosp wants to merge 1 commit intolongbridge:mainfrom
Open
Conversation
- New component to group keyboard shortcuts - Gallery story for manual testing - Documentation page matching Kbd structure - Fix sidebar sorting to alphabetical - Remove duplicate gallery entry from sed - Tests for single and multiple Kbd elements
huacnlee
requested changes
May 3, 2026
Member
huacnlee
left a comment
There was a problem hiding this comment.
This not need a single story, please merge into kbd_story.rs
huacnlee
reviewed
May 3, 2026
| use crate::{ActiveTheme, StyledExt, h_flex, kbd::Kbd}; | ||
|
|
||
| /// A group of `Kbd` elements, rendered with a "+" separator between them. | ||
| #[derive(IntoElement)] |
huacnlee
reviewed
May 3, 2026
|
|
||
| A component for grouping multiple `Kbd` elements, automatically inserting a \"+\" separator between them. This mimics the visual style of key‑binding instructions like **Ctrl+C** or **Cmd+Shift+P**. | ||
|
|
||
| ## Import |
huacnlee
reviewed
May 3, 2026
| test: | ||
| cargo nextest run | ||
|
|
||
| # ----------------------------------------------------------------------- |
Member
There was a problem hiding this comment.
Please not add this, I don't like it.
Makefile can handle that, please submit another PR.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add
KbdGroupcomponentProblem: There was no built‑in way to display a sequence of keyboard shortcuts with a visual separator between them (e.g.,
Ctrl + CorCmd + Shift + P). Developers had to assemble this manually.Solution:
KbdGroup, which accepts one or more existingKbdelements and renders them with a “+” separator.Kbdpage (imports, usage, platform-adaptive output, examples, styling).KbdGroupappears directly afterKbd.All changes are purely additive and do not affect existing functionality.
Screenshot
Break Changes
None.
How to Test
Ran doc story and test
Checklist
cargo runfor story tests related to the changes.