Replies: 2 comments 1 reply
-
In yew you attach event listeners to html elements https://yew.rs/docs/concepts/html/events // pseudo code
let onkeydown = Callback::from(move |event|{
// get the pressed key using web-sys out of the event
);
html!{<div {onkeydown} />} |
Beta Was this translation helpful? Give feedback.
1 reply
-
Try use_event and use_event_with_window from yew_hooks: https://github.com/jetli/yew-hooks use_event_with_window("keydown", move |e: KeyboardEvent| {
// e.key_code()
}); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I want to use keyboard click event like this:
Is it possible to implement this directly in yew?
Beta Was this translation helpful? Give feedback.
All reactions