Skip to content

Commit

Permalink
Embedded apps for 1.36.0 (#1085)
Browse files Browse the repository at this point in the history
* Add another fragment example

* Add horizontal bar chart example

* Add column vertical alignment examples

* Bump to nightly
  • Loading branch information
sfc-gh-dmatthews authored Jun 14, 2024
1 parent 557d7c6 commit 1947a3a
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 1 deletion.
10 changes: 10 additions & 0 deletions python/api-examples-source/charts.bar_chart_horizontal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import streamlit as st
from vega_datasets import data

@st.cache_data
def get_data():
return data.barley()

source = get_data()

st.bar_chart(source, x="variety", y="yield", color="site", horizontal=True)
14 changes: 14 additions & 0 deletions python/api-examples-source/execution.fragment_balloon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import streamlit as st
import time


@st.experimental_fragment
def release_the_balloons():
st.button("Release the balloons", help="Fragment rerun")
st.balloons()


with st.spinner("Inflating balloons..."):
time.sleep(5)
release_the_balloons()
st.button("Inflate more balloons", help="Full rerun")
7 changes: 7 additions & 0 deletions python/api-examples-source/layout.columns_bottom_widgets.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import streamlit as st

left, middle, right = st.columns(3, vertical_alignment="bottom")

left.text_input("Write something")
middle.button("Click me", use_container_width=True)
right.checkbox("Check me")
14 changes: 14 additions & 0 deletions python/api-examples-source/layout.columns_vertical_alignment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import streamlit as st
import numpy as np

vertical_alignment = st.selectbox(
"Vertical alignment", ["top", "center", "bottom"], index=2
)

left, middle, right = st.columns(3, vertical_alignment=vertical_alignment)
left.image("https://static.streamlit.io/examples/cat.jpg")
left.markdown("By [@phonvanna](https://unsplash.com/photos/0g7BJEXq7sU)")
middle.image("https://static.streamlit.io/examples/dog.jpg")
middle.markdown("By [@shotbyrain](https://unsplash.com/photos/rmkIqi_C3cA)")
right.image("https://static.streamlit.io/examples/owl.jpg")
right.markdown("By [@zmachacek](https://unsplash.com/photos/ZN4CzqizIyI)")
3 changes: 2 additions & 1 deletion python/api-examples-source/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ altair>=5.0.0
pydeck==0.8.0
Faker==19.1.0
openai==1.3.0
streamlit==1.35.0
vega_datasets
streamlit-nightly

0 comments on commit 1947a3a

Please sign in to comment.