Skip to main content

Themeable Streamlit table component (React + TanStack) with stable in-component state.

Project description

mm-streamlit-table

An opinionated, themeable Streamlit table component built with React + TanStack Table. MIT-licensed and dependency-light.

Why this exists: most Streamlit table components either rerun the entire page on every interaction (selection loops, lost filter state) or are styled in a way that resists customisation. mm-streamlit-table keeps UI state inside the component and only emits semantic events back to Streamlit.

Features

  • No rerun loops. Sort, filter, expand, and resize are local. Streamlit only hears about events you care about (selection, action clicks).
  • Themeable from Python via a small set of generic design tokens that map to CSS custom properties. Drop in your own tokens or override the CSS variables directly.
  • Real React renderers — bring your own cell components (tags, JSON chips, copy-to-clipboard, badges, anything you write in TSX).
  • No enterprise license. Filtering features that AG Grid puts behind a paywall (multi-filter, set filter) are built in.

Install

pip install mm-streamlit-table

Quick start

import pandas as pd
import streamlit as st
from mm_streamlit_table import mm_table

df = pd.DataFrame(
    {
        "id": [1, 2, 3],
        "name": ["Alpha", "Bravo", "Charlie"],
        "score": [42, 17, 99],
    }
)

result = mm_table(df, selection="single", row_id_column="id", key="demo")

if result and result.get("event") == "select":
    st.write("You picked:", result["row_ids"])

Theming

Pass any subset of these tokens via theme_tokens=; missing keys fall back to neutral defaults:

Token Purpose
bg Table background
bg_alt Striped row background
text Body text colour
text_muted Empty-state and hints
border Outer border
border_subtle Row dividers
header_bg Header row background
header_text Header row text
accent Accent / selection ring
selected_bg Selected row background
row_hover_bg Hover background
font Body font stack
font_mono Header / mono font stack

Repo layout

mm_streamlit_table/          ← Python package
  __init__.py                ← declare_component + public API
  frontend/build/            ← built JS bundle (generated)
frontend/                    ← React/TS source
  src/
  package.json
  vite.config.ts

Dev loop

In one terminal:

cd frontend
npm install
npm run dev               # serves on http://localhost:3001

In another terminal, in your app:

pip install -e ../mm-streamlit-table
export MM_STREAMLIT_TABLE_DEV=1   # or set MM_STREAMLIT_TABLE_DEV=1 on Windows
streamlit run your_app.py

Edit a .tsx file → browser updates. No Streamlit restart needed.

Release build

cd frontend
npm run build             # writes to ../mm_streamlit_table/frontend/build
cd ..
python -m build           # builds the wheel

License

MIT.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mm_streamlit_table-0.0.5.tar.gz (443.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mm_streamlit_table-0.0.5-py3-none-any.whl (443.6 kB view details)

Uploaded Python 3

File details

Details for the file mm_streamlit_table-0.0.5.tar.gz.

File metadata

  • Download URL: mm_streamlit_table-0.0.5.tar.gz
  • Upload date:
  • Size: 443.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.5 {"installer":{"name":"uv","version":"0.10.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for mm_streamlit_table-0.0.5.tar.gz
Algorithm Hash digest
SHA256 9550535c313c824f286d9ee3f3bad359e373d85ec069aaad64d903e35a254680
MD5 78b93a730cc08243c78b58b876f136a4
BLAKE2b-256 aa43fd28680c1e733d33561112208ad0a266f838d8b53c85a11ab9a42505c1fd

See more details on using hashes here.

File details

Details for the file mm_streamlit_table-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: mm_streamlit_table-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 443.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.5 {"installer":{"name":"uv","version":"0.10.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for mm_streamlit_table-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 e6a23cbddaaf9c79c06b3ca02c499d9efdce11628bd62408ee3230b4374aa76d
MD5 1c4098d7f1d5babbe4ae93df23da56a2
BLAKE2b-256 551d37a57b0c56ddd7127bbb0679a937ccb5ec22806fe026b528d906e5f307e5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page