Skip to main content

Extra-Streamlit-Components

Downloads Downloads Downloads

An all-in-one place, to find complex or just not available components by default on streamlit.

Explained in details in my book Web Application Development with Streamlit

Components

Firstly, add import extra_streamlit_components as stx

  • Router

  • Route to specific pages in Streamlit. This leverages the use of query parameters to make custom routes in your Streamlit application. For best experience, make sure to include the st.cache_resource function decorator while initializing the Router object.

      @st.cache_resource(hash_funcs={"_thread.RLock": lambda _: None})
      def init_router():
          return stx.Router({"/home": home, "/landing": landing})
    
      def home():
          return st.write("This is a home page")
    
      def landing():
          return st.write("This is the landing page")
    
      router = init_router()
      router.show_route_view()
    
      c1, c2, c3 = st.columns(3)
    
      with c1:
          st.header("Current route")
          current_route = router.get_url_route()
          st.write(f"{current_route}")
      with c2:
          st.header("Set route")
          new_route = st.text_input("route")
          if st.button("Route now!"):
              router.route(new_route)
      with c3:
          st.header("Session state")
          st.write(st.session_state)
    
  • A browser cookie store and manager. Built on universal-cookie with the capability of using its options

    Security Note: In shared domains such as share.streamlit.io, other web developers can have access to the cookies you set and the same goes for you. This is not to be treaded as security bug but a circumstance the developer need to be aware of.

    import datetime
    st.write("# Cookie Manager")
    
    @st.fragment
    def get_manager():
        return stx.CookieManager()
    
    cookie_manager = get_manager()
    
    st.subheader("All Cookies:")
    cookies = cookie_manager.get_all()
    st.write(cookies)
    
    c1, c2, c3 = st.columns(3)
    
    with c1:
        st.subheader("Get Cookie:")
        cookie = st.text_input("Cookie", key="0")
        clicked = st.button("Get")
        if clicked:
            value = cookie_manager.get(cookie=cookie)
            st.write(value)
    with c2:
        st.subheader("Set Cookie:")
        cookie = st.text_input("Cookie", key="1")
        val = st.text_input("Value")
        if st.button("Add"):
            cookie_manager.set(cookie, val) # Expires in a day by default
    with c3:
        st.subheader("Delete Cookie:")
        cookie = st.text_input("Cookie", key="2")
        if st.button("Delete"):
            cookie_manager.delete(cookie)
    

  • TabBar

    Inspire from React's ScrollMenu, this component receives a list of TabBarItemData, and returns the id of the selected tab

    chosen_id = stx.tab_bar(data=[
        stx.TabBarItemData(id=1, title="ToDo", description="Tasks to take care of"),
        stx.TabBarItemData(id=2, title="Done", description="Tasks taken care of"),
        stx.TabBarItemData(id=3, title="Overdue", description="Tasks missed out"),
    ], default=1)
    st.info(f"{chosen_id=}")
    

  • BouncingImage

    Probably not the best naming but this component, renders an image by its path or url, and animates by zooming in and out repetitively giving an illusion of a bounce.

    image_url = "https://streamlit.io/images/brand/streamlit-logo-secondary-colormark-darktext.svg"
    stx.bouncing_image(image_source=image_url, animate=True, animation_time=1500, height=200, width=600)
    

  • StepperBar

    A streamlit wrapper on MaterialUI's Stepper

    val = stx.stepper_bar(steps=["Ready", "Get Set", "Go"])
    st.info(f"Phase #{val}")
    

"Buy Me A Coffee"

Metadata

Release files for extra-streamlit-components 0.1.81

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

Source distribution (sdist)

Source distribution for extra-streamlit-components 0.1.81
File Size Uploaded Provenance Actions
extra_streamlit_components-0.1.81.tar.gz 2.3 MB Without provenance Details for extra_streamlit_components-0.1.81.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for extra-streamlit-components 0.1.81
File Interpreter ABI Platform Actions
extra_streamlit_components-0.1.81-py3-none-any.whl Python 3 none any Details for extra_streamlit_components-0.1.81-py3-none-any.whl

Total release size: 4.5 MB

Release files / extra_streamlit_components-0.1.81.tar.gz

Download URL extra_streamlit_components-0.1.81.tar.gz
Size 2.3 MB
Tags Source
SHA-256 checksum
How to use checksums
eb9beb7bacfe8b3d238f1888a21c78ac6cfa569341be484bca08c3ea0b15f20d
BLAKE2b-256 checksum
How to use checksums
24499b47a3450034d74259f9d4887d85be4e6a771bc21da467b253323d78c4d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.31.0 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.10

Release files / extra_streamlit_components-0.1.81-py3-none-any.whl

Download URL extra_streamlit_components-0.1.81-py3-none-any.whl
Size 2.3 MB
Tags Python 3
SHA-256 checksum
How to use checksums
11a4651dbd03cac04edfbb8711757b1d10e3cdf280b8fa3a43f970d05e684619
BLAKE2b-256 checksum
How to use checksums
fd8dd2f1eeb52c50c990d14fd91bea35157890bb791c46b3f2bebaa5eef4bdf6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.31.0 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.10

Security for extra-streamlit-components 0.1.81

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.

Release history Release notifications | RSS feed

This release

0.1.81 This release

2 release files No provenance

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