β¨οΈΒ Β Keyboard text
Submitted by Arnaud Miribel
Summary
Create a keyboard styled text
Functions
key
Applies a custom CSS to input text which makes it look like a keyboard key. To be used after running load_key_css() at least once in the app!
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text |
str
|
Text that will be styled as a key |
required |
write |
bool
|
If True, this will st.write() the key |
True
|
Returns: str: HTML of the text, styled as a key
Source code in src/streamlit_extras/keyboard_text/__init__.py
Import:
- You should add this to the top of your .py file
Examples
example_default
Output (beta)
example_inline
def example_inline():
load_key_css()
st.write(
f"Also works inline! Example: {key('β+K', write=False)}",
unsafe_allow_html=True,
)