Is there a way to place the keyup trigger but inside a component?

I’m making a component that I want to have keyboard shortcuts, I know that the keyup workflow returns me in the event which key was clicked, which is functional to make my shortcut, but how do I put this trigger inside the component