Extra Streamlit Components is a Python library that provides a collection of complex or natively unavailable components to enhance Streamlit applications. It aims to offer advanced UI elements such as a Router for multi-page apps, a Cookie Manager for browser interaction, and a TabBar. The library is currently at version 0.1.81 and receives updates periodically.
pip install extra-streamlit-componentsVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates the usage of the `TabBar` component to create a multi-tab interface in a Streamlit application. It defines three tabs and displays content based on the user's selection.
Decorate your `init_router` function with `@st.cache_resource(hash_funcs={"_thread.RLock": lambda _: None})`.Check for updated versions of `extra-streamlit-components` and Streamlit. Some users have reported manual deployment (not via CI/CD) or specific Streamlit versions (e.g., 1.32.0 improved custom component handling) mitigating issues. Debugging browser console logs may provide further insight. (See GitHub Issues #6, #67, Streamlit forum discussions)
If encountering this, consider pinning to a version prior to 0.1.71 if feasible for your project, or explore custom CSS overrides in your Streamlit app to counteract the conflicting styles.
Avoid storing sensitive user data directly in browser cookies when deploying on shared domains. Use server-side sessions or more secure authentication mechanisms for critical information.
Ensure the library is correctly installed in your active Python environment using `pip install extra-streamlit-components`. If using a virtual environment, activate it first.
Check for updated versions of `extra-streamlit-components` and Streamlit, as newer versions may have improved custom component handling. Debug browser console logs for more insights. Manual deployment or specific Streamlit versions (e.g., 1.32.0 improved custom component handling) might mitigate the issue.
Introduce a mechanism to ensure the `CookieManager` is fully initialized and its internal cookie state is populated before attempting to `get` or `set` cookies. Using `st.session_state` to store the manager and check its readiness, or adding small `time.sleep()` delays in specific contexts, can help. The `CookieManager` constructor can also trigger a rerun, so managing state carefully is crucial.
Decorate your `init_router` function with `@st.cache_resource(hash_funcs={'_thread.RLock': lambda _: None})` to ensure the Router is initialized only once and its state persists across app reruns.