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

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.

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.

Download files

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

Source Distribution

reflex_monocharts-0.1.2.tar.gz (36.3 kB view details)

Uploaded Source

Built Distribution

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

reflex_monocharts-0.1.2-py3-none-any.whl (40.6 kB view details)

Uploaded Python 3

File details

Details for the file reflex_monocharts-0.1.2.tar.gz.

File metadata

  • Download URL: reflex_monocharts-0.1.2.tar.gz
  • Upload date:
  • Size: 36.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for reflex_monocharts-0.1.2.tar.gz
Algorithm Hash digest
SHA256 1fbc11d8a32e87daec76684d7786d6a69b9f4abae98965cc9cae491e258b29b5
MD5 e8bb1bfeffcc08a13f7710a708c5f161
BLAKE2b-256 95967ab73214f339262a481fbb749d3cbf855c1fb21cf36c0aafcbc96e67d5e8

See more details on using hashes here.

Provenance

The following attestation bundles were made for reflex_monocharts-0.1.2.tar.gz:

Publisher: release.yml on ecrespo/reflex-monocharts

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file reflex_monocharts-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for reflex_monocharts-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 603e7ec85f6455aeb15e02556f1233a7b2210c3731679481762f5f36b75b3c7a
MD5 0328f2a7993050a06f17ab3afc5c8b61
BLAKE2b-256 87bdb6f8271328c72a6d0d6208095e432ca94bf206688bde74e02067386e3293

See more details on using hashes here.

Provenance

The following attestation bundles were made for reflex_monocharts-0.1.2-py3-none-any.whl:

Publisher: release.yml on ecrespo/reflex-monocharts

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 files

0.1.1

2 files

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