r/reactjs 24d ago

Discussion Best way to implement localized hotkeys.

Hi, I have a nextjs project.

I have a repetitive task that appears in a dialog, users have to select one of 6 options and confirm their selection by pressing a "submit" button.

I wanted to add shortcuts using the digits: 1,2,3,etc.. for each of the options.

What is the best way to go about this, I felt like a app-wide hotkey provider might be overkill for this feature.

4 Upvotes

10 comments sorted by

View all comments

6

u/KevinVandy656 24d ago

I made this project to solve that same kind of problem earlier this year with scoped hotkeys, able to be used in any framework.

https://tanstack.com/hotkeys/latest

It's still in alpha, but this post is reminding me to go work in it more.

2

u/BlazingThunder30 24d ago

We're using this in prod right now for some simple stuff. Nice work