Skip to main content

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.

Dependencies: Uses other custom components I created:

Installation instructions

pip install streamlit-custom-sidebar
# Pre-requisites

create `.streamlit/config.toml` directory where the main app.py file is located

in there, input 
[ui]
hideSidebarNav=true

or 

start streamlit app with 
`streamlit run app.py --ui.hideSidebarNav=true`

Usage instructions

import streamlit as st
from streamlit_custom_sidebar import CustomSidebarDefault
import streamlit_float # recommended

# Note - on the page's first load - when user comes in from the url rather than clicking on the tab, the active page will be derived from the url or from the `loadPageName` parameter. Please make sure all params in the data array object are inputed.

st.set_page_config(layout="wide")

streamlit_float.float_init(theme=False, include_unstable_primary=False)

# iconLib (key,variable in the data list of dicts - its required) -> "Remix", "Tabler", "Google"
data_ = [
            {"index":0, "label":"Example", "page":"example", "href":"http://localhost:8501/"},
            {"index":1, "label":"Page", "page":"page", "iconLib":"Google", "icon":"settings", "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=False, backgroundColor="brown", loadPageName="example", data=data_, LocalOrSessionStorage=1, serverRendering=False, webMedium="local") 
    defaultSidebar.load_custom_sidebar()
    defaultSidebar.change_page()
    
    streamlit_float.float_parent(css="position:fixed; 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

Metadata

Release files for streamlit-custom-sidebar 0.0.16

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for streamlit-custom-sidebar 0.0.16
File Size Uploaded Provenance
streamlit-custom-sidebar-0.0.16.tar.gz 10.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for streamlit-custom-sidebar 0.0.16
File Interpreter ABI Platform
streamlit_custom_sidebar-0.0.16-py3-none-any.whl Python 3 none any Details

Total release size: 20.5 kB

Release files / streamlit-custom-sidebar-0.0.16.tar.gz

Download URL streamlit-custom-sidebar-0.0.16.tar.gz
Size 10.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c2a0f3294a6161921914c8d2ae260477ad1957069f57e8dc2c0d5e720a7b319d
BLAKE2b-256 checksum
How to use checksums
0fe295b73f6858a7e8052528a325aa78eadb65ea94f1976e9098ead2c5a39299
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release files / streamlit_custom_sidebar-0.0.16-py3-none-any.whl

Download URL streamlit_custom_sidebar-0.0.16-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
230dfd8cce06abcdcafbf7d008d1a1cfa7afebdd30cc5714639683c0c3ab7e69
BLAKE2b-256 checksum
How to use checksums
f8071a9383d18c7c994431d032e94a1a03e43f58dcc7e67c90dddb8b9c565eb7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Security for streamlit-custom-sidebar 0.0.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page