gpui-component
gpui-component copied to clipboard
kbd: Add KbdGroup component.
Description
Add KbdGroup component
Problem: There was no built‑in way to display a sequence of keyboard shortcuts with a visual separator between them (e.g., Ctrl + C or Cmd + Shift + P). Developers had to assemble this manually.
Solution:
- Introduced
KbdGroup, which accepts one or more existingKbdelements and renders them with a “+” separator. - Added a gallery story to show usage examples (single, multiple, and styled groups).
- Added unit tests ensuring the component creates successfully with one and several children.
- Added documentation page that mirrors the structure of the
Kbdpage (imports, usage, platform-adaptive output, examples, styling). - Fixed the documentation sidebar to sort alphabetically so
KbdGroupappears directly afterKbd. - Cleaned up a duplicate gallery entry that was accidentally inserted during the scripted creation.
All changes are purely additive and do not affect existing functionality.
Screenshot
| Before | After |
|---|---|
| [Put Before Screenshot here] |
Break Changes
None.
How to Test
Ran doc story and test
Checklist
- [x] I have read the CONTRIBUTING document and followed the guidelines.
- [x] Reviewed the changes in this PR and confirmed AI generated code (If any) is accurate.
- [x] Passed
cargo runfor story tests related to the changes. - [ ] Tested macOS, Windows and Linux platforms performance (if the change is platform-specific)