Spaces:
Sleeping
Sleeping
Download custom_button.py from GSMEthesis/study1: direct link, hf CLI and curl.
- Browser
- Download file 774 Bytes
-
https://huggingface.co/spaces/GSMEthesis/study1/resolve/76db210c5b9429e93e6c58d7594de3f5d9afc9de/custom_button.py
- Command line
-
hf download hf://spaces/GSMEthesis/study1@76db210c5b9429e93e6c58d7594de3f5d9afc9de/custom_button.py
-
curl -L -o custom_button.py https://huggingface.co/spaces/GSMEthesis/study1/resolve/76db210c5b9429e93e6c58d7594de3f5d9afc9de/custom_button.py
774 Bytes
| import streamlit.components.v1 as components | |
| # کامپوننت اختصاصی | |
| def custom_button(text, key=None): | |
| components.html( | |
| f""" | |
| <!DOCTYPE html> | |
| <html> | |
| <body> | |
| <button id="{key}" | |
| style="background-color:#28a745;color:white;border:none; | |
| border-radius:8px;padding:10px 20px;font-weight:bold; | |
| width:100%;cursor:pointer;" | |
| onclick="sendClick()"> | |
| {text} | |
| </button> | |
| <script> | |
| function sendClick() {{ | |
| window.parent.postMessage("{key}_clicked", "*"); | |
| }} | |
| </script> | |
| </body> | |
| </html> | |
| """, | |
| height=50 | |
| ) |