Component package ecosystem
Reflex organizes its component model into a shared base contract, standard UI packages, internal first-party components, and optional integrations with React libraries. These packages let Python UI declarations use built-in and specialized browser capabilities through the same component, state, and event model. See the component system for the wider render model.
Package layers
Base package
The reflex-base package defines the shared contract for Reflex components. It gives components a common place for children, browser properties, styles, events, and the library that supplies their browser behavior. Standard and third-party packages use this contract to join the same page and state model.
References: packages/…/pyproject.toml• L1-15 packages/…/component.py• L338-360 packages/…/component.py• L776-886
Core package
The reflex-components-core package supplies the standard Reflex building blocks. It covers raw HTML elements, media and SVG content, page structure, layout, data display, conditional and responsive rendering, uploads, clipboard access, and browser window events. These general-purpose pieces form the shared UI layer for more focused packages.
References: packages/…/pyproject.toml• L1-17 packages/…/__init__.py• L1-20 packages/…/__init__.py• L1-60 packages/…/window_events.py• L54-85 packages/…/__init__.py• L1-24 packages/…/media.py• L54-103 packages/…/media.py• L277-301 packages/…/py.typed
Internal package
The reflex-components-internal package provides first-party interface pieces shared by Reflex applications and the Reflex product. It offers ready-to-use controls and common UI behavior such as dialogs, menus, inputs, tabs, overlays, loading states, icons, and class names. It is an internal layer because it depends on the full Reflex package rather than only the minimal base contract.
References: packages/…/pyproject.toml• L1-12 packages/…/__init__.py• L1-52 packages/…/py.typed
Integration packages
Integration packages adapt focused browser libraries to the shared Reflex component contract. They keep optional library dependencies outside the core UI layer, while exposing typed Python namespaces for a focused product area.
| Package | Product role |
|---|---|
reflex-components-radix | Accessible controls, layout, typography, themes, and lower-level Radix primitives. |
reflex-components-recharts | React chart building blocks and complete Cartesian, polar, and composed charts. |
reflex-components-plotly | Plotly graphs with focused browser bundles for different graph types. |
reflex-components-markdown | Markdown rendering with mapped Reflex components and optional processing features. |
reflex-components-code | Syntax-highlighted code blocks and Markdown code rendering. |
reflex-components-gridjs | Searchable, sortable, resizable, and paged data tables. |
reflex-components-dataeditor | Editable data grids with selection and cell-edit events. |
reflex-components-sonner | Toast notification providers and event-driven toast messages. |
reflex-components-lucide | Static and dynamic Lucide icons. |
reflex-components-moment | Formatted and relative date or duration display. |
reflex-components-react-player | Audio and video playback with media events. |
These packages normally depend on reflex-base. Packages that compose standard or Radix pieces also depend on those related component packages. This keeps each library's browser assets and behavior close to the Reflex API that exposes them.
References: packages/…/pyproject.toml• L1-14 packages/…/pyproject.toml• L1-10 packages/…/pyproject.toml• L1-13 packages/…/pyproject.toml• L1-15 packages/…/pyproject.toml• L1-15 packages/…/pyproject.toml• L1-10 packages/…/pyproject.toml• L1-13 packages/…/pyproject.toml• L1-13 packages/…/pyproject.toml• L1-10 packages/…/pyproject.toml• L1-10 packages/…/pyproject.toml• L1-13 packages/…/py.typed packages/…/py.typed packages/…/py.typed packages/…/py.typed packages/…/py.typed packages/…/py.typed packages/…/py.typed packages/…/py.typed packages/…/py.typed packages/…/py.typed packages/…/py.typed
Component package relationships
Component package contract
An integration component presents a browser library through the Reflex model. It names the browser component or export and defines the properties and events that Python code can use. The shared contract then carries that component through the page's styles, imports, hooks, and custom browser code. For guidance on creating an adapter, see component authoring.
References: packages/…/component.py• L338-355 packages/…/component.py• L827-910 packages/…/component.py• L940-1028 packages/…/recharts.py• L8-21
Package dependency flow
The package relationship moves from a stable component contract to standard UI pieces and then to optional library adapters. A specialized package can reuse core components for layout or shared behavior while keeping its external browser dependency at the edge.
This diagram shows how a component package joins the compiled page.
flowchart TD
A[Reflex application] --> B[Reflex component tree]
B --> C[reflex-base component contract]
C --> D[reflex-components-core standard UI]
C --> E[Optional integration packages]
E --> F[External React UI libraries]
D --> G[Compiled page and browser UI]
E --> G
Package entry points expose named factories or namespaces for this flow. Lazy package exports let an application select a component area without making every integration part of the core UI surface.
References: packages/…/__init__.py• L5-20 packages/…/__init__.py• L1-19 packages/…/__init__.py• L1-126 packages/…/__init__.py• L1-32 packages/…/__init__.py• L1-5 packages/…/__init__.py• L1-5 packages/…/__init__.py• L1-8 packages/…/__init__.py• L1-8 packages/…/__init__.py• L1-3
Specialized library families
Radix controls and themes
Radix is the broadest UI family in the ecosystem. Its theme components provide a consistent surface for controls, layout, typography, avatars, menus, and tooltips. Its primitive components expose lower-level behavior when an application needs more direct control. The Radix package also connects theme use to an app-level provider and style sheet, so theme components affect the surrounding application. See styling and theming for the wider style model.
Radix menus model a complete interaction flow from a trigger to content and optional submenus. Context menus use the same pattern for pointer or long-press actions. Tooltips provide contextual information from a focused or hovered control, while avatars provide an image with fallback text when the image is not available.
Radix text fields preserve the same behavior when an input is hidden by a literal value, reactive value, or browser-side change. The wrapper hides with the input, while an explicit display style remains the user's choice. This prevents an empty field bar without overriding deliberate layout styling.
References: packages/…/mappings.py• L5-133 packages/…/base.py• L96-128 packages/…/plugin.py• L20-92 packages/…/avatar.py• L18-46 packages/…/context_menu.py• L32-69 packages/…/dropdown_menu.py• L33-80 packages/…/tooltip.py• L36-115 packages/…/text_field.py• L27-55 packages/…/6876.bugfix.md• L1
Charts and visual data
Chart integrations turn data and chart settings into interactive visual output. Recharts exposes responsive chart containers with Cartesian, composed, treemap, Sankey, and polar chart families. Its polar pieces support pies, radars, radial bars, axes, and grids. Plotly offers a separate graph surface with focused bundles for basic, Cartesian, geographic, 2D, 3D, finance, strict, and MapLibre views.
Both chart families connect browser interaction back to Reflex events. Recharts supports chart and series interaction. Plotly returns selected point data and supports plot lifecycle, view, selection, and hover events. Plotly also accepts locale settings and keeps a legacy Mapbox path for migration to MapLibre.
References: packages/…/charts.py• L37-121 packages/…/charts.py• L300-391 packages/…/charts.py• L714-768 packages/…/charts.py• L771-854 packages/…/polar.py• L26-129 packages/…/polar.py• L132-272 packages/…/__init__.py• L5-32 packages/…/plotly.py• L126-236 packages/…/plotly.py• L238-344 packages/…/plotly.py• L445-689
Markdown and code content
The Markdown integration turns one Markdown source into a Reflex component tree. A component map chooses the Reflex component for each Markdown element, so headings, links, lists, and code blocks can use the application's UI system. Optional processing adds features such as GitHub-style Markdown, math, raw HTML, and KaTeX. The code package supplies syntax-highlighted blocks and can add a copy action.
References: packages/…/markdown.py• L166-201 packages/…/markdown.py• L227-265 packages/…/markdown.py• L468-575 packages/…/code.py• L382-430
Grids and data editors
The grid integrations support two different data interaction goals. Grid.js presents data as a table with search, sort, resize, and pagination. Glide Data Grid presents a richer editing surface with cell, row, column, selection, and editing events. Both keep the data contract in Reflex while adapting the browser library's display and interaction model.
References: packages/…/datatable.py• L16-46 packages/…/datatable.py• L47-128 packages/…/dataeditor.py• L181-220 packages/…/dataeditor.py• L321-399
Notifications and supporting UI
The Sonner integration treats notifications as application events rather than ordinary content inside a page. A toaster provider supplies the browser service, and event helpers send, classify, and dismiss messages from Reflex event handlers. Lucide supplies icons for this and other packages. Moment and React Player cover focused date and media needs without adding those browser libraries to the core package.
References: packages/…/toast.py• L172-240 packages/…/toast.py• L242-296 packages/…/toast.py• L404-418 packages/…/__init__.py• L1-3 packages/…/icon.py• L16-24 packages/…/__init__.py• L1-5 packages/…/moment.py• L29-35 packages/…/__init__.py• L1-8 packages/…/react_player.py• L130-168 packages/…/__init__.py• L1-8
Component use flow
The package ecosystem turns a Python component expression into a browser view while keeping the same Reflex state and event path. A specialized package selects the browser capability. The base contract carries it through compilation, and the resulting events connect browser activity back to application state.
This diagram shows how a specialized component participates in the application loop.
flowchart LR
A[Python app composition] --> B[Component tree]
B --> C[Base component contract]
C --> D[Core or integration package]
D --> E[Library imports and page assets]
D --> F[Browser component]
F --> G[User interaction]
G --> H[Reflex event and state update]
H --> B
The package layer chooses the browser capability. The base contract carries the component through compile time. Events and state values then connect the browser result back to the same application tree. For package authoring guidance, see component authoring. For the wider component model, see component system.
References: packages/…/component.py• L336-355 packages/…/component.py• L860-943 packages/…/state.js• L1-25 packages/…/state.js• L27-50
Change checklist
When these files or sections are changed, remember to consider these:
- Keep package dependency direction aligned with the layer model. A base or core change can affect every integration package.
- Keep lazy-loader name maps aligned with package exports. A renamed public component can fail only when an app first imports that name.
- When a wrapped library changes its tag, package name, style sheet, or companion dependency, review the generated page imports and browser assets together.
- When an integration changes an event payload, update the Python event contract and the state value shape as one boundary.
- When Radix theme behavior changes, review both the plugin assets and the app-level wrapper. Local Radix components depend on both.
- When Radix input visibility changes, review both state-driven visibility and explicit
displaystyles. The wrapper must follow the input without overriding user layout intent. - When Markdown defaults change, review its links to Radix typography and code components. The default map is a cross-package contract.
- When a core browser event or media element changes, review its event payload and the browser element or listener that consumes it.
- When a chart family or chart event changes, review both the public namespace and the accepted data or point payload.
- When Plotly bundle variants change, keep their namespace names, browser bundles, and MapLibre migration path aligned.
- When Radix compound controls change, keep their root, trigger, content, submenu, and event relationships valid together.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| An integration names a browser package without declaring its package dependency. | The generated page cannot load the component or fails during the frontend build. | Keep the component library and package dependency declarations together. |
| A Radix theme component is used while its theme assets are not active. | Controls render without the expected theme styles or app-level theme behavior. | Configure the Radix theme plugin when the application relies on theme components. |
| A hidden Radix input leaves its wrapper visible. | The page shows an empty bar where the hidden input should be absent. | Keep wrapper visibility tied to the rendered input and let an explicit display style win. |
| A compound Radix menu uses a trigger, content, or submenu outside its valid relationship. | The menu cannot provide its intended open, focus, or selection behavior. | Keep each menu part under its matching root and use the package namespace for the compound structure. |
| Markdown receives zero children or more than one source child. | Markdown creation fails because there is no single source to parse. | Pass one string or string-valued state variable to the Markdown component. |
A list is passed to DataTable without columns. | The table cannot determine its column headers. | Supply columns for list data; let DataFrame input provide its own columns. |
DataEditor selection changes are handled without updating its selection state. | The browser grid does not reflect the new selection after an event. | Treat the selection state and selection-change event as one contract. |
| A toast event runs without a toaster provider. | The toast is not shown. | Add the provider or use the documented alert fallback when a provider may be absent. |
| A Recharts chart receives a dimension that is not an integer or percentage. | Chart creation fails before the chart can render. | Use pixel integers or percentage dimensions and size the parent container with CSS. |
| A legacy Plotly Mapbox figure is used without its migration path. | The graph can warn or use renamed traces and layout keys instead of the original Mapbox names. | Prefer the MapLibre plotly.map component and MapLibre figure names. |
Key files
| File | Why to read it |
|---|---|
| packages/…/component.py | Defines the common component contract and the boundary between component props and compiled browser output. |
| packages/…/__init__.py | Shows the standard behavior and utility surface exposed by the core package. |
| packages/…/window_events.py | Shows how page-level browser events return through the Reflex event model. |
| packages/…/__init__.py | Shows how raw HTML elements form the base UI vocabulary. |
| packages/…/media.py | Shows the core media and SVG vocabulary used for browser content. |
| packages/…/__init__.py | Shows the first-party internal component namespace and its high-level UI groups. |
| packages/…/mappings.py | Shows the Radix theme, primitive, layout, and typography families. |
| packages/…/plugin.py | Shows how Radix theme assets and app-level wrapping enter a page. |
| packages/…/avatar.py | Shows the themed avatar and image fallback surface. |
| packages/…/context_menu.py | Shows the compound context-menu interaction surface. |
| packages/…/dropdown_menu.py | Shows the compound dropdown-menu interaction surface. |
| packages/…/tooltip.py | Shows the themed contextual-information surface and its accessibility label. |
| packages/…/text_field.py | Shows the text-field behavior that keeps hidden inputs from leaving an empty wrapper. |
| packages/…/charts.py | Shows the chart families, responsive sizing boundary, and specialized Sankey and treemap surfaces. |
| packages/…/polar.py | Shows the polar chart parts and their interaction boundary. |
| packages/…/markdown.py | Shows how Markdown source becomes mapped Reflex components and optional processing features. |
| packages/…/datatable.py | Shows the table data model and table feature boundary. |
| packages/…/dataeditor.py | Shows the editable grid state and event boundary. |
| packages/…/toast.py | Shows the provider and event model for notifications. |
| packages/…/plotly.py | Shows how graph data, focused bundles, migration support, and browser plot events are adapted to Reflex. |