Skip to main content

reflex-ant-design

Ant Design (antd) wrapped as Reflex components — build enterprise-grade UIs in pure Python.

This is a Reflex custom component package. It exposes the Ant Design React components (Button, Table, Form, DatePicker, Modal, and ~90 more) as Reflex components you can drive entirely from Python state, with theming through ConfigProvider.

Status: 0.1.0 — alpha. The API surface is broad and may still change.

Installation

With uv (recommended):

uv add reflex-ant-design

With pip:

pip install reflex-ant-design

The antd npm package is installed automatically by Reflex the first time you run your app.

Quickstart

import reflex as rx
from reflex_ant_design import antd, icon


class State(rx.State):
    name: str = ""

    @rx.event
    def set_name(self, value: str):
        self.name = value


def index() -> rx.Component:
    return antd.config_provider(
        antd.card(
            antd.space(
                antd.input(
                    value=State.name,
                    on_change=State.set_name,
                    placeholder="Your name",
                    prefix=icon("UserOutlined"),
                ),
                antd.button("Greet", type="primary", icon=icon("SmileOutlined")),
                antd.text(f"Hello!", strong=True),
                direction="vertical",
            ),
            title="reflex-ant-design",
        ),
        theme={"token": {"colorPrimary": "#722ed1", "borderRadius": 8}},
    )


app = rx.App()
app.add_page(index)

Two ways to import

# 1) Namespace (mirrors rx.*)
from reflex_ant_design import antd
antd.button("Save", type="primary")

# 2) Flat factories
from reflex_ant_design import button, table, date_picker
button("Save", type="primary")

Examples

Data table from state

COLUMNS = [
    {"title": "Name", "dataIndex": "name", "key": "name"},
    {"title": "Role", "dataIndex": "role", "key": "role"},
]
DATA = [
    {"key": "1", "name": "Ada", "role": "Engineer"},
    {"key": "2", "name": "Alan", "role": "Researcher"},
]

antd.table(columns=COLUMNS, data_source=DATA, pagination={"pageSize": 5})

Select bound to state

antd.select(
    value=State.country,
    on_change=State.set_country,
    options=[{"label": "Spain", "value": "es"}, {"label": "Japan", "value": "jp"}],
    show_search=True,
    allow_clear=True,
)

Modal driven by a boolean

antd.button("Open", on_click=State.open_modal)
antd.modal(
    antd.text("Are you sure?"),
    open=State.modal_open,
    title="Confirm",
    on_ok=State.close_modal,
    on_cancel=State.close_modal,
)

Theming

Wrap your app (or any subtree) in config_provider and pass design tokens:

antd.config_provider(
    your_app(),
    theme={"token": {"colorPrimary": "#13c2c2", "borderRadius": 6}},
    component_size="large",
)

Component catalog

Category Components
General Button, FloatButton (+ Group, BackTop), Typography (Title/Text/Paragraph/Link), icon()
Layout Divider, Flex, Row/Col, Layout (Header/Sider/Content/Footer), Space (+ Compact), Splitter
Navigation Anchor, Breadcrumb, Dropdown (+ Button), Menu, Pagination, Steps, Tabs
Data Entry Input (+ TextArea/Search/Password/OTP), InputNumber, Checkbox, Radio, Select, Switch, Slider, Rate, DatePicker, RangePicker, TimePicker, AutoComplete, Cascader, TreeSelect, Mentions, ColorPicker, Transfer, Upload, Form
Data Display Avatar, Badge, Card, Carousel, Collapse, Descriptions, Empty, Image, List, Popover, Tooltip, QRCode, Segmented, Statistic, Table, Tag, Timeline, Tour, Tree
Feedback Alert, Drawer, Modal, Popconfirm, Progress, Result, Skeleton, Spin, Watermark
Config ConfigProvider, App

See docs/guides/usage.md for per-category notes and the gotchas (date values, imperative message/notification, form binding).

Try the demo

git clone https://github.com/ecrespo/reflex-ant-design
cd reflex-ant-design
make install
cd reflex_ant_design_demo && uv run reflex run

Documentation

Compatibility

  • Reflex >= 0.7
  • antd@^6 (works with React 19 shipped by Reflex 0.7+). Pin antd@^5 for apps on React 18 — see the compatibility guide.

Contributing

See CONTRIBUTING.md.

License

MIT © Ernesto Crespo

Metadata

Release files for reflex-ant-design 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-ant-design 0.2.0
File Size Uploaded Provenance
reflex_ant_design-0.2.0.tar.gz 47.2 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 100.1 kB

Release files / reflex_ant_design-0.2.0.tar.gz

Download URL reflex_ant_design-0.2.0.tar.gz
Size 47.2 kB
Tags Source
SHA-256 checksum
How to use checksums
daab922e6bf236114700d2a43df7539eb8d155b27894bbd3596f9b75e026e427
BLAKE2b-256 checksum
How to use checksums
b21136901b7ab10df9180bd2a6c0c1bd9375b67e5b65d60782095006f2a0f294
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.9

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

Download URL reflex_ant_design-0.2.0-py3-none-any.whl
Size 52.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ff405c25deaacc1f39a650454535a485f168783f0d38e102f95afd053fa231bc
BLAKE2b-256 checksum
How to use checksums
a6560812b4252a61e6b1a8aaeefb69202b27fd5a6775f22dcf9b66dbcfa99726
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.9

Security for reflex-ant-design 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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

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