Give your buttons keyboard shortcuts

Hey guys,

I noticed this was a recurrent problem, and the solutions I found were often not elegant and broken or incomplete. So I wrapped it all up in an easy to install through pip package.

You can find it on my Github repo here

Example usage:

import streamlit as st
from streamlit_shortcuts import add_keyboard_shortcuts

def delete_callback():
    st.write("DELETED!")

st.button("delete", on_click=delete_callback)

add_keyboard_shortcuts({
    'Ctrl+Shift+X': 'delete',
})
4 Likes

That’s great!

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.