-
Notifications
You must be signed in to change notification settings - Fork 74
/
Copy pathButton.py
34 lines (23 loc) · 1.01 KB
/
Button.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import streamlit as st
import streamlit_shadcn_ui as ui
st.header("Button")
with open("docs/components/button.md", "r") as f:
st.markdown(f.read())
st.subheader("Click Events")
clicked = ui.button("Click", key="clk_btn")
reset = ui.button("Reset", variant="secondary", key="reset_btn")
st.write("UI Button Clicked:", clicked)
st.write("UI Reset Button Clicked:", reset)
st.subheader("Variants")
variant_options = ["default", "destructive", "outline", "secondary", "ghost", "link"]
for variant in variant_options:
ui.button(text=f"Button ({variant})", variant=variant, key=variant)
st.subheader("Custom style of button")
st.markdown('''
```python
ui.button(text="Beautiful Button", key="styled_btn_tailwind", className="bg-orange-500 text-white")
```
> class_name and className are both supported, class_name is used in python layer and will be converted to className for the frontend
''')
ui.button(text="Beautiful Button", key="styled_btn_tailwind", className="bg-orange-500 text-white")
st.write(ui.button)