Extra Streamlit Components

0.1.81 · active · verified Mon Apr 13

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.

Warnings

Install

Imports

Quickstart

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.

import streamlit as st
import extra_streamlit_components as stx

st.set_page_config(layout="centered", page_title="Extra Streamlit Components Demo")
st.title("Extra Streamlit Components Demo")

# Example using TabBar component
chosen_id = stx.tab_bar(
    data=[
        stx.TabBarItemData(id="tab1", title="Tab One", description="First tab content"),
        stx.TabBarItemData(id="tab2", title="Tab Two", description="Second tab content"),
        stx.TabBarItemData(id="tab3", title="Tab Three", description="Third tab content"),
    ],
    default="tab1",
    key="tab_bar_example"
)

if chosen_id == "tab1":
    st.write("You are on Tab One!")
elif chosen_id == "tab2":
    st.write("You are on Tab Two!")
elif chosen_id == "tab3":
    st.write("You are on Tab Three!")

view raw JSON →