Skip to content

New design: Kbd component#1097

Merged
memagu merged 2 commits intonew-designfrom
new-design-kbd
Mar 23, 2026
Merged

New design: Kbd component#1097
memagu merged 2 commits intonew-designfrom
new-design-kbd

Conversation

@memagu
Copy link
Copy Markdown
Member

@memagu memagu commented Feb 16, 2026

🧩 Summary

Look at title

🔗 Related issues (if any)

Closes #961

📸 Screenshots / recordings (if applicable)

Run and look or smth

💬 Other information

None

@memagu memagu requested a review from SLUCHABLUB February 16, 2026 21:21
@memagu memagu self-assigned this Feb 16, 2026
@github-project-automation github-project-automation bot moved this to 🆕 New in CPU Feb 16, 2026
@SLUCHABLUB
Copy link
Copy Markdown
Contributor

Screenshot from 2026-02-16 22-43-49 Set lajte knas ut

@SLUCHABLUB
Copy link
Copy Markdown
Contributor

Också, src/routes/+page.svelte borde nog återställas innan vi mergar

Comment thread src/lib/components/ui/kbd/kbd.svelte Outdated
@SLUCHABLUB
Copy link
Copy Markdown
Contributor

Också, från instruktionerna (#947)

Important: Make a commit immediately after adding the component, and make a separate commit for your changes. It's easier to review what is your changes vs shadcn that way.

Copy link
Copy Markdown
Collaborator

@christofergartner christofergartner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does NOT work on my machine. Safari macOS 26.3.

@SLUCHABLUB
Copy link
Copy Markdown
Contributor

Safari macOS

User error

@SLUCHABLUB
Copy link
Copy Markdown
Contributor

As per my last review, it is hard to see what is changed from shadcn, I'd reccomend rebasing. Nonetheless, running the first example on the kbd page i get an error.

<div class="flex flex-col items-center gap-4">
 <Kbd.Group>
  <Kbd.Root></Kbd.Root>
  <Kbd.Root></Kbd.Root>
  <Kbd.Root></Kbd.Root>
  <Kbd.Root></Kbd.Root>
 </Kbd.Group>
 <Kbd.Group>
  <Kbd.Root>Ctrl</Kbd.Root>
  <span>+</span>
  <Kbd.Root>B</Kbd.Root>
 </Kbd.Group>
</div>

This gives me Cannot read properties of undefined (reading 'toLowerCase'). Seems that the symbol prop was somehow set to undefined. The call does not appear in the shadcn code.

@SLUCHABLUB SLUCHABLUB linked an issue Mar 4, 2026 that may be closed by this pull request
@memagu
Copy link
Copy Markdown
Member Author

memagu commented Mar 20, 2026

Thanks will fix!

@memagu
Copy link
Copy Markdown
Member Author

memagu commented Mar 21, 2026

Fully reworked component and correctly committed component addition before customization for a clearer diff.

NOTE: New version was force pushed to alter commit history and thus nuked my previous slop :D

Key features:

  • Support for pressing multiple keys simultaneously.
  • Optional case insensitivity for trigger keys

Successfully tested with:

<script>
  import NotImplemented from "$lib/components/NotImplemented.svelte";
  import { Kbd, KbdGroup } from "$lib/components/ui/kbd";
  import Footer from "./(app)/Footer.svelte";
  import Navbar from "./(app)/Navbar.svelte";
</script>

<nav class="contents">
  <Navbar />
</nav>

<div class="flex flex-col items-center gap-4">
  <KbdGroup>
    <Kbd symbol="" trigger="Meta" />
    <Kbd symbol="" trigger="Shift" />
    <Kbd symbol="" trigger="Alt" />
    <Kbd symbol="" />
  </KbdGroup>
  <KbdGroup>
    <Kbd symbol="Ctrl" trigger="Control" />
    <span>+</span>
    <Kbd symbol="B" caseInsensitive />
  </KbdGroup>
</div>

<NotImplemented />
<Footer />

NOTE: The API is a bit different from the ChadCN example as can be seen above. This is due to the interactive nature of our version.

Producing the following with alt/option and ctrl held down:
image

Correctly highlights multiple keys when pressed simultaneously
@memagu memagu changed the title Add kbd component New design: Kbd component Mar 21, 2026
@memagu memagu dismissed christofergartner’s stale review March 21, 2026 01:56

Safari (🤡) not supported

@memagu memagu requested review from fgren and removed request for DagHemberg March 21, 2026 02:04
Copy link
Copy Markdown
Contributor

@SLUCHABLUB SLUCHABLUB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only one question, otherwise it looks great. Good job!

Comment thread src/lib/components/ui/kbd/kbd.svelte
Copy link
Copy Markdown
Contributor

@SLUCHABLUB SLUCHABLUB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I assume that it works on MacOS now too.

@memagu
Copy link
Copy Markdown
Member Author

memagu commented Mar 23, 2026

Looks good! I assume that it works on MacOS now too.

@christofergartner pls test, haven't been able to test Safari.

@memagu
Copy link
Copy Markdown
Member Author

memagu commented Mar 23, 2026

@Fiery-132 Verified on Safari!

@memagu memagu merged commit 28fa2b9 into new-design Mar 23, 2026
1 check passed
@memagu memagu deleted the new-design-kbd branch March 23, 2026 16:57
@github-project-automation github-project-automation bot moved this from 🆕 New to ✅ Done in CPU Mar 23, 2026
Isak-Kallini pushed a commit that referenced this pull request Mar 23, 2026
* Add kbd component

* Customize kbd component

Correctly highlights multiple keys when pressed simultaneously
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

Add kbd component

3 participants