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.2.tar.gz (435.2 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.2-py3-none-any.whl (440.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mm_streamlit_table-0.0.2.tar.gz
  • Upload date:
  • Size: 435.2 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.2.tar.gz
Algorithm Hash digest
SHA256 b651da18e3369ef2493525f5e6b5d03b84319468e6bc4b55b0b538ebd2ed9ef3
MD5 3618436979cbaafe36e4417828da4e4d
BLAKE2b-256 46690929a9c10410d3561fc64e6e036f6fece9bba6958e5cb6a81971631ef91a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mm_streamlit_table-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 440.7 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 803d5d0b45ac192f3c8c510f10bb9e224800b03de625cb87bcbc1a628a4be55c
MD5 d7d4bd04327d66333b4526ce4095d312
BLAKE2b-256 5449536829efe511fb072cbcee65e24751176fb9958932f031a67a80a3b9ed7c

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