Skip to main content

reflex-monocharts

Monochromatic, rounded chart cards for Reflex — a pure-Python port of the Monocharts design system.

28 components: splines, pill bars, gradient areas, donuts, radars, radial gauges, bullet targets, treemaps, heatmaps, candlesticks, Sankey bands and a GitHub-style contribution grid. All one hue, all rounded, dark and light.

pip install reflex-monocharts

Requires Python 3.11+ and Reflex 0.10.0 or newer.

Monocharts for Reflex, dark Monocharts for Reflex, light

Why a port and not a wrapper

Monocharts ships as copy-paste React/TSX built on Recharts and Tailwind, with the data hard-coded in each component. Reflex already wraps Recharts, so this library rebuilds the design system in Python instead of shipping JavaScript:

  • No npm dependency and no Tailwind requirement. Every class is translated to Reflex style props, so the cards drop into any Reflex app unchanged.
  • Data-driven. Each chart takes data plus *_key arguments and binds to rx.State. Call it with no arguments and you get the original demo card.
  • Reactive theming. theme= accepts "dark", "light", or a state Var, so a toggle re-themes every card without a reload. compact= works the same way.

Quick start

import reflex as rx
from reflex_monocharts import monocharts as mc


class State(rx.State):
    theme: str = "dark"
    traffic: list[dict] = [
        {"hour": "02:00", "hits": 18},
        {"hour": "06:00", "hits": 34},
        {"hour": "10:00", "hits": 72},
    ]

    @rx.event
    def toggle_theme(self):
        self.theme = "light" if self.theme == "dark" else "dark"


def index() -> rx.Component:
    return rx.vstack(
        rx.button("Toggle theme", on_click=State.toggle_theme),
        mc.area(
            State.traffic,
            x_key="hour",
            value_key="hits",
            theme=State.theme,
            title="Traffic",
            badge="Live",
            unit="requests",
        ),
        mc.gauge(84, theme=State.theme),
        width="420px",
    )

Long names are available too — mc.area is mono_rounded_area_chart.

The catalog

Short name Function What it draws
mc.line mono_rounded_line_chart Spline with a dashed baseline series
mc.step mono_rounded_step_chart Discrete staircase
mc.sparkline mono_rounded_sparkline_chart Stacked telemetry rows with micro splines
mc.kpi mono_rounded_kpi_card_chart Big KPI over a gradient sparkline
mc.bar mono_rounded_bar_chart Pill bars, as columns or rows
mc.stacked_bar mono_rounded_stacked_bar_chart Tonal stack with rounded ends
mc.composed mono_rounded_composed_chart Outlined columns plus a spline
mc.waterfall mono_rounded_waterfall_chart Floating delta pillars
mc.funnel mono_rounded_funnel_chart Horizontal pipeline stages
mc.bullet mono_rounded_bullet_chart Progress bars with benchmark markers
mc.pyramid mono_rounded_pyramid_chart Hierarchy tiers
mc.candlestick mono_rounded_candlestick_chart OHLC candles with rounded wicks
mc.area mono_rounded_area_chart Curved area with a soft gradient
mc.range mono_rounded_range_chart Floating min-max band
mc.stream mono_rounded_stream_chart Two natural-spline waves
mc.donut mono_rounded_donut_chart Donut with rounded caps and a centre readout
mc.radar mono_rounded_radar_chart Multi-axis polygon web
mc.polar mono_rounded_polar_chart 360-degree radial pillars
mc.radial_group mono_rounded_radial_bar_group Half-circle arc group
mc.radial_gauge mono_rounded_radial_gauge_chart Concentric progress rings
mc.gauge mono_rounded_gauge_arc 240-degree speedometer dial
mc.meter mono_rounded_meter_chart Semicircle meter
mc.scatter mono_rounded_scatter_chart Weighted node matrix
mc.bubble mono_rounded_bubble_chart Outlined bubbles, area-encoded
mc.heatmap mono_rounded_heatmap_chart Labelled density matrix
mc.treemap mono_rounded_treemap_chart Rounded partition tiles
mc.sankey mono_rounded_sankey_chart Curved flow bands
mc.activity mono_activity_heatmap Contribution grid (green/blue/purple/mono)

Common arguments

Every chart accepts these, on top of its own *_key arguments:

Argument Meaning
data Rows to plot. Omit for the built-in demo dataset.
theme "dark", "light", or a state Var.
compact Short card instead of tall. Accepts a Var.
title / badge The uppercase eyebrow and the pill beside it.
value / unit The headline metric and its muted suffix. Derived from the data when omitted.
footer_left / footer_right The two monospace footer captions.
control A component rendered flush right in the header.
**props Any extra style props, forwarded to the card.

Interactive controls

The originals bake their toggles into the component. Here the option is a prop, so it can be wired to your own state — mono_segmented renders the matching pill control:

from reflex_monocharts import mono_segmented, monocharts as mc


class State(rx.State):
    curve: str = "monotone"

    @rx.event
    def set_curve(self, value: str):
        self.curve = value


mc.area(
    curve=State.curve,
    control=mono_segmented(
        [("monotone", "Monotone"), ("natural", "Natural")],
        State.curve,
        State.set_curve,
        theme=State.theme,
    ),
)

The same pattern drives series= on the line card, orientation= on the bar card and show_trend= on the hybrid card.

Building your own cards

The chrome is exported, so a custom chart can sit in the same system:

from reflex_monocharts import mono_card, mono_header, mono_stage, mono_footer, mono_tooltip

mono_card(
    mono_header("My Metric", "Custom", "1,204", "events", theme="dark"),
    mono_stage(my_chart, theme="dark"),
    mono_footer("Left caption", "Right caption", theme="dark"),
    theme="dark",
)

ink(), ink_alpha(), pick() and is_dark() from reflex_monocharts.theme resolve the monochrome palette for either a plain theme string or a Var.

Notes and deliberate differences

  • Badge and footer rule are theme-aware here. Upstream hard-codes bg-white/10 text-white and border-white/5, which is invisible on the light card; this port resolves both per theme.
  • The tooltip is rx.recharts.graphing_tooltip styled to match the original's blurred dark panel. Recharts' content render-prop takes a React component, which Reflex cannot pass, so the styling is reproduced through content_style / item_style / label_style.
  • Gradients are defined in a hidden sibling <svg> with a process-unique id, so several gradient-filled cards can share a page.
  • mono_activity_heatmap seeds its RNG so the grid is stable across re-renders. Pass seed=None to data.activity_contributions for the original random behaviour, and use a native title tooltip per cell rather than a server round-trip for 140 cells.
  • mono_rounded_candlestick_chart needs explicit low_bound/high_bound when data is a state Var, since the price scale cannot be derived at build time. mono_rounded_sankey_chart computes its band geometry in Python and takes a plain list.

Demo app

cd monocharts_demo
uv run reflex run

The gallery shows every chart, a live-state section wired to rx.State, a theme toggle, a compact toggle and a category filter.

Releasing

Bump __version__ in custom_components/reflex_monocharts/__init__.py, merge develop into main, then tag the merge commit:

git tag v0.2.0 && git push origin v0.2.0

The Release workflow re-runs CI, checks the tag matches the package version, publishes to PyPI and creates the GitHub release with the built files attached.

Changelog

  • 0.2.0 — Requires Reflex 0.10.0+ and Python 3.11+ (Python 3.10 support dropped). CI workflows run JavaScript actions on Node 24.
  • 0.1.2 — PyPI publishing from the release workflow on version tags.
  • 0.1.1 — Fixed an invalid PyPI classifier.
  • 0.1.0 — Initial release: 28 monochrome chart cards.

Credits

Design system by Syed Subhan — see Monocharts and amicro. This is an independent Python port for Reflex, not affiliated with the original project.

MIT licensed.

Metadata

Release files for reflex-monocharts 0.2.0

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

Source distribution (sdist)

Source distribution for reflex-monocharts 0.2.0
File Size Uploaded Provenance
reflex_monocharts-0.2.0.tar.gz 36.9 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for reflex-monocharts 0.2.0
File Interpreter ABI Platform
reflex_monocharts-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 77.9 kB

Release files / reflex_monocharts-0.2.0.tar.gz

Download URL reflex_monocharts-0.2.0.tar.gz
Size 36.9 kB
Tags Source
SHA-256 checksum
How to use checksums
4af8baf3606a6c6917a5164e0943d5ea4ae8705a4264504fbd43ce077782ddbb
BLAKE2b-256 checksum
How to use checksums
c894f30e710cb8c4249db88e7c6a08e5dbe4c9e035175233938ed832b6028d7e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.

Transparency log

Release files / reflex_monocharts-0.2.0-py3-none-any.whl

Download URL reflex_monocharts-0.2.0-py3-none-any.whl
Size 41.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ba8f95837b4ead0537c9872d82c019a5f83cd6bbd65ce22786463aa89b2d2b01
BLAKE2b-256 checksum
How to use checksums
91820c158c16d727c3c752dd233a102f60c44232ebb54c8b6e0f2ea3f65c7b97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.

Transparency log

Security for reflex-monocharts 0.2.0

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for reflex_monocharts-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 25, 2026.

Transparency log

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.

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