Streamlit component that allows you to do create a more flexible customisable streamlit sidebar
Project description
streamlit-custom-sidebar
Streamlit component that allows you to do buid a more flexible customizable sidebar that does not look buggy when rendered. Usually when we try to adjust the native streamlit sidebar it gets rendered after all the streamlit default settings are rendered. With this, your default settings are rendered when the page loads but it still uses streamlit's sidebar mative settings - css like its open and close animation and buttons.
Uses other custom components I created: local storage session storage
Installation instructions
pip install streamlit-custom-sidebar
Usage instructions
import streamlit as st
from streamlit_custom_sidebar import CustomSidebarDefault
import streamlit_float # recommended
streamlit_float.float_init()
data_ = [
{"index":0, "label":"Example", "page":"example", "href":"http://localhost:8501/"},
{"index":1, "label":"Page", "page":"page", "icon":"ri-logout-box-r-line", "href":"http://localhost:8501/page"}
]
if "currentPage" not in st.session_state: # required as component will be looking for this in session state to change page via `switch_page`
st.session_state["currentPage"] = data_[0]
else:
st.session_state["currentPage"] = data_[0]
with st.container():
defaultSidebar = CustomSidebarDefault(closeNavOnLoad=True, backgroundColor="brown", loadPageName="example", data=data_, LocalOrSessionStorage=1, serverRendering=False, webMedium="local")
defaultSidebar.load_custom_sidebar()
defaultSidebar.change_page()
streamlit_float.float_parent(css="top:-1000px;") # gets rid of the whitespace created from the iframes used to build the component - no big forehead.
# The above must be rendered atop every streamlit page
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for streamlit-custom-sidebar-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6bca4569db00b9db83bbf1d0496781f8df2ed0aefee964c65e7a745bdaedd660 |
|
MD5 | 43a000cdf9cb2707373ee1a424445539 |
|
BLAKE2b-256 | d71c6883498d33dd9dcff3f7b1e0c17310e0aa731c4237cc1bc442b169dcbbca |
Close
Hashes for streamlit_custom_sidebar-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 67aa07ef48bdc8eec8fd8f73cd58d97a4b85317426b0129f1d4487fdaac74b9d |
|
MD5 | 03cb1bad00aca7c88a45e5ab06fc408a |
|
BLAKE2b-256 | 847eab3f7445cd9b0cfbd086d37e1d9c8979b73865c93a98747ae0a071f3179f |