Skip to content

Commit

Permalink
feat: add fn win alt keys (#4638)
Browse files Browse the repository at this point in the history
* feat: add new keys

* feat: add new keys

* chore: update docs & storybook as well

---------

Co-authored-by: WK Wong <[email protected]>
  • Loading branch information
winchesHe and wingkwong authored Jan 30, 2025
1 parent 69aa476 commit 8452603
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/stale-tips-kneel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@heroui/kbd": patch
---

Add fn win alt keys (#4499)
5 changes: 4 additions & 1 deletion apps/docs/content/docs/components/kbd.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,8 @@ type KbdKey =
| "home"
| "end"
| "help"
| "space";
| "space"
| "fn"
| "win"
| "alt";
```
11 changes: 10 additions & 1 deletion packages/components/kbd/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ export type KbdKey =
| "home"
| "end"
| "help"
| "space";
| "space"
| "fn"
| "win"
| "alt";

export const kbdKeysMap: Record<KbdKey, string> = {
command: "⌘",
Expand All @@ -39,6 +42,9 @@ export const kbdKeysMap: Record<KbdKey, string> = {
end: "↘",
help: "?",
space: "␣",
fn: "Fn",
win: "⌘",
alt: "⌥",
};

export const kbdKeysLabelMap: Record<KbdKey, string> = {
Expand All @@ -61,6 +67,9 @@ export const kbdKeysLabelMap: Record<KbdKey, string> = {
end: "End",
help: "Help",
space: "Space",
fn: "Fn",
win: "Win",
alt: "Alt",
};

export type KbdKeysLabelType = typeof kbdKeysLabelMap;
3 changes: 3 additions & 0 deletions packages/components/kbd/stories/kbd.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ export default {
"end",
"help",
"space",
"fn",
"win",
"alt",
],
},
},
Expand Down

0 comments on commit 8452603

Please sign in to comment.