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.4.tar.gz (443.7 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.4-py3-none-any.whl (443.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mm_streamlit_table-0.0.4.tar.gz
  • Upload date:
  • Size: 443.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for mm_streamlit_table-0.0.4.tar.gz
Algorithm Hash digest
SHA256 d65fa32f7b5c94ddab6baa542433f61d73ddd6e226b4d4494d194d1a4ab7b60b
MD5 aa8b159d177f66ca44276e4489de803f
BLAKE2b-256 da5f8b68332137a57d5f2b606c3c378e4a095b6de6d665c21379d0dc52e479bc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mm_streamlit_table-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 cdd5635dd3b7897d607c6915fb8dd723de3c0c5c172e3a39d57b95d791a53e4b
MD5 69e05a0c99232e2a8532921a04cc9898
BLAKE2b-256 1a0a710c9d3086e9ed0a6d983ad7b127dd7289b15a6932ba4e027611d6b45d54

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