| import streamlit as st |
|
| st.set_page_config(page_title=“Material Icon Examples“, page_icon=“:material/rocket:“) |
|
| st.title(„Material Icons in Streamlit Widgets“) |
|
| # 1. Button with an icon and text |
| st.subheader(„1. Button with an icon and text“) |
| st.button(„Save File“, icon=“:material/save:“) |
|
| # 2. Button with only an icon |
| st.subheader(„2. Button with only an icon“) |
| st.button(„“, icon=“:material/favorite:“) |
|
| st.subheader(„3. Pills with only icons“) |
|
| # 3. Pills with only icons |
| categories = [ |
| „:material/home:“, |
| „:material/dashboard:“, |
| „:material/settings:“, |
| „:material/favorite:“, |
| ] |
|
| # Pills element (multi-selection) |
| selected_pills = st.pills( |
| „Choose categories“, |
| options=categories, |
| selection_mode=“multi“, |
| ) |
|
| st.write(„You selected:“, selected_pills) |