Releases: reflex-dev/reflex
v0.3.10
New Features
Lucide Icons (rx.lucide.icon
)
View all iconds available via rx.lucide.icon
at https://lucide.dev/icons/.
In 0.4.0, these icons will become the default icon set exposed at rx.icon
.
- add lucide icons as a candidate for core icon library by @Lendemor in #2444
- fix kebab case for lucide icon by @Lendemor in #2487
- fix color of icon to match theme by @Lendemor in #2488
- fix icon_button to size children lucide icon correctly. by @Lendemor in #2515
Customize Reflex Directory location
Set REFLEX_DIR
environment variable to control where reflex will download and install supporting
tools like bun
, fnm
, and node
.
- Added Environmental variable REFLEX_DIR by @wassafshahzad in #2457
Improvements
Only expose /_upload
when using Upload component
- auto enable /_upload endpoint only if Upload component is used by @benedikt-bartscher in #2430
- Move
is_used
to Upload component rather than UploadFilesProvider by @masenf in #2514
Better SQLAlchemy Interoperability
- parse return type annotations of sqlalchemy hybrid properties by @benedikt-bartscher in #2422
- improve sqlalchemy type parsing by @benedikt-bartscher in #2474
Faster .pyi Generation (internal)
- use multiprocessing to speed up pyi generation by @benedikt-bartscher in #2453
- pyi generator git diff by @benedikt-bartscher in #2460
- Add git precommit hook that generates pyi files by @martinxu9 in #2447
- Fix pyi_generator relative path determination by @masenf in #2485
- Minor fix on pyi generator to make it work in Windows by @tankztz in #2494
Fast Compilation
Use multiprocessing
to compile CPU-bound pages faster.
- use process pool to compile faster by @jackie-pc in #2497
Bug Fixes
- Vardata for rx.Match by @ElijahAhianyo in #2439
- fix SmartDisplay visible parameter by @benedikt-bartscher in #2451
- fixed issue with hypens by @wassafshahzad in #2450
- Set correct type when indexing into Var[str] by @picklelo in #2469
- Update meta parameter to accept a list of any type by @kumaraguru1735 in #2477
Radix
The team is currently stabilizing the new radix-ui integration in preparation for our forthcoming 0.4.0
release.
- Clean up Radix Form component by @martinxu9 in #2423
- Input high level api by @picklelo in #2410
- radix link renders as next link by default use by @martinxu9 in #2440
- Docstrings for radix components by @masenf in #2407
- Chakra IconButton comes from "@chakra-ui/button@2.1.0" package by @masenf in #2465
- small changes to texfield and separator by @tgberkeley in #2448
- Accordion style merge issue fix by @ElijahAhianyo in #2446
- [REF-1746] Define
value
prop on base rx.el.textarea by @masenf in #2467 - minor update to callout by @tgberkeley in #2466
- add separator default width to fill the container by @tgberkeley in #2459
- Remove modal prop from Dialog by @martinxu9 in #2470
- [REF-1763] Rename
color
tocolor_scheme
in all radix themes components by @masenf in #2468 - Pass down themes for
rx.cond
andrx.match
by @ElijahAhianyo in #2432 - Use form_root as form high level API by @martinxu9 in #2479
- [REF-1632] Apply
rx.App
styles to Radix Themes rootdiv
by @masenf in #2481 - Radix primitive based Drawer component by @martinxu9 in #2445
- [REF-1815] Radix themes: replace
color_scheme
withcolor
in get_fields by @masenf in #2486 - [WIP] rx.color by @Alek99 in #2443
- add center / spacer / hstack / vstack in radix/themes/layout by @Lendemor in #2331
- Fix accordion pyi by @picklelo in #2491
- [REF-1738] Remove radix-specific layout/margin props by @masenf in #2442
- [REF-1742] Radio group prop types fix by @ElijahAhianyo in #2452
- Support component create methods as keys in global styles by @picklelo in #2498
- Add props from Radix tooltip primitives to tooltip component by @martinxu9 in #2499
- radix Theme panel_background prop: transparent -> translucent by @martinxu9 in #2504
- All event handlers inherit from event triggers by @tgberkeley in #2507
- Add comment for theme panel needed for docs by @Alek99 in #2508
- Refactor rx.color by @Alek99 in #2522
- Add dropdown props inherited from their primitive counterparts by @martinxu9 in #2521
Other Changes
- extend state inheritance tests with non-computed vars by @benedikt-bartscher in #2425
- test_telemetry fails for Python Version 3.11.0rc1 by @Yummy-Yums in #2431
- [REF-1692] re-enable partial reflex web windows by @masenf in #2436
- simple pytest benchmark for measuring event <=> state update round trip time by @jackie-pc in #2489
- Rework telemetry to support installation_id by @jackie-pc in #2480
- Update hosting CLI version in the poetry lock: 0.1.3 -> 0.1.7 by @martinxu9 in #2503
- fix appharness regex for functions with return type by @benedikt-bartscher in #2512
New Contributors
- @Yummy-Yums made their first contribution in #2431
- @kumaraguru1735 made their first contribution in #2477
- @tankztz made their first contribution in #2463
Full Changelog: v0.3.9...v0.3.10
v0.3.9
New Features
Mixin Classes can now be used to augment State subclasses
- inherit computed vars from state mixins by @benedikt-bartscher in #2351
Improvements
- Import radix as rx.radix by @picklelo in #2374
- Pin version for data editor deps by @ElijahAhianyo in #2383
- Skip frontend packages install if previously done by @jackie-pc in #2400
Bug fixes
- Resolve correct python path on windows by @ElijahAhianyo in #2373
- fix is_backend_variable for dunder prefixed variables by @benedikt-bartscher in #2391
- [REF-1705] Do not overwrite Var attributes during format by @masenf in #2421
Radix UI Preview
- update radix components by @tgberkeley in #2380
- Clean up Radix Avatar components props by @martinxu9 in #2375
- aspectratio: fix docstring and extra literal def by @masenf in #2379
- Fix docstrings and comments for Box and Card components by @masenf in #2385
- Correct Radix Themes Slider props by @masenf in #2386
- Inset: fix comment by @masenf in #2389
- Overlay Components Improvements by @Alek99 in #2395
- Accordion by @Alek99 in #2310
- Remove default radix theme by @picklelo in #2403
- high level api for checkbox by @tgberkeley in #2406
- create high level api for select component by @tgberkeley in #2402
- radiogroup high level api by @tgberkeley in #2401
- update to allow items to be autogenerated for docs by @tgberkeley in #2419
- Radix callout high level api by @picklelo in #2409
Other Changes
- Update comments in template apps by @masenf in #2370
- Get rid of compile in readme by @Alek99 in #2371
- integration tests: disable windows builds for reflex-web by @masenf in #2417
- Allow app harness tests to import State subclasses by @masenf in #2408
Full Changelog: v0.3.8...v0.3.9
v0.3.8
Deprecations
app.compile()
boilerplate is no longer required
- apps should no longer call "app.compile()" by @jackie-pc in #2291
- Remove
app.compile()
from templates by @masenf in #2327
New Features
rx.match
construct
rx.match
acts as a switch
statement, mapping multiple values to components or props.
rx.button(
State.mood,
background_color=rx.match(
State.mood,
("happy", "yellow"),
("sad", "blue"),
("angry", "red"),
("tickled", "pink"),
"", # last value provided is the default
)
)
- rx.match component by @ElijahAhianyo in #2318
Add rx.time_picker
component
- add time_picker component by @macmoritz in #2343
Improvements
- add size prop to the number input by @dodeca-6-tope in #2311
- Add darkMode for Tailwind config by @romain-bury in #2312
- Add reflex init app name validator, prevent import failure during reflex run by @Jishnu-Nandhiath in #2336
- Support Bare SQLAlchemy DeclarativeBase models access via State
- support parsing type args of DeclarativeBase subclasses by @benedikt-bartscher in #2348
Bug Fixes
- REF-1476/Create .web only after template selection by @ElijahAhianyo in #2288
- Chakra input component type_ prop literal by @ElijahAhianyo in #2292
- Bug fix: Export should only excludes assets folder if it's in the top level by @martinxu9 in #2308
- fix tailwind for stateful components imported from utils by @Lendemor in #2328
- Fix browser warning when rendering lists via
rx.markdown
- fix editable property of columns being ignored in data_editor by @Lendemor in #2338
- Allow tailwind to be completely disabled
- Handle VarData roundtrip when encoded value contains newline by @masenf in #2350
Radix UI Preview
- Add high-level API for accordion by @picklelo in #2285
- color_scheme props added and updated pyi files by @Lendemor in #2279
- Fixing bugs in radix by @tgberkeley in #2316
- Apply default theme to apps by @picklelo in #2320
- Lendemor/radix form primitive by @Lendemor in #2306
- adding cancel and action sub components for alert dialog and rename alert dialog root by @tgberkeley in #2352
Other
- Update outdated
docs/tr/README.md
with some fixes. by @hasansezertasan in #2303 #2341 - Refactor chakra components into separate folder by @picklelo in #2315
- Update README.md by @kalyani2003 in #2330
- update inline so all props have comments by @tgberkeley in #2353
- Enable real app AppHarness tests to not specify
state=
by @masenf in #2358
New Contributors
- @hasansezertasan made their first contribution in #2303
- @romain-bury made their first contribution in #2312
- @kalyani2003 made their first contribution in #2330
- @Jishnu-Nandhiath made their first contribution in #2336
- @macmoritz made their first contribution in #2343
Full Changelog: v0.3.7...v0.3.8
v0.3.7
New Features
Improvements
- Support SQLAlchemy v2
- Support
redis:
andrediss:
uri forREDIS_URI
(and allow authentication)- use redis-py url syntax for redis_url by @benedikt-bartscher in #2267
- capture exceptions thrown by any process in run_concurrently_context by @jackie-pc in #2296
Bug Fixes
- update the join function by @tgberkeley in #2270
- REF-1451/DataFrame Serializer fix by @ElijahAhianyo in #2281
- [REF-1464] Handle requirements.txt encoding by @martinxu9 in #2284
Radix (WiP)
- Core radix-ui/themes components
- wrap radix icons by @Lendemor in #2263
- Implement accordion component by @picklelo in #2262
- [REF-1417] Convert underscore-prefixed style props to pseudo selector by @masenf in #2266
Other Changes
- Warning if newer reflex/reflex-hosting-cli available by @Alek99 in #2271
- Bump to v0.3.7 by @picklelo in #2298
New Contributors
- @benedikt-bartscher made their first contribution in #2267
Full Changelog: v0.3.6...v0.3.7
v0.3.6
This release fixes an issue with v0.3.5 in using base HTML components with state.
What's Changed
- [REF-1425] Always capitalize tag of StatefulComponent by @masenf in #2264
- bugfix: hosting deploy command checks requirements when interactive by @martinxu9 in #2260
- Bump to v0.3.6 by @picklelo in #2268
- Format var better in error message by @picklelo in #2269
Full Changelog: v0.3.5...v0.3.6
v0.3.5
Known Issues
Using rx.el.*
namespace tags with State vars is not currently working (#2264)
Breaking Changes
Component._get_app_wrap_components
is now astaticmethod
for performance reasons.
Deprecations
Deprecated features will not be removed until reflex-0.4.0.
- Deprecate event namespace config knob by @ElijahAhianyo in #2218
- update removal version of deprecated features by @Lendemor in #2224
- deprecate state arg in App() by @Lendemor in #2237
Improvements
Performance
This release includes numerous performance improvements during both compile phase and at runtime.
Backend
- [REF-1035] Track ComputedVar dependency per class by @masenf in #2067
- Reduce memory and deserialization time for every app user.
- [REF-201] Separate on_load handler from initial hydration by @masenf in #1847
- Avoid expensive hydration of entire state when navigating between pages (with @ElijahAhianyo)
Frontend
Each substate in an app can now be accessed independently. Components which depend on any state are automatically pulled out of the main page component and defined within separate "memoized" components that only update when the substates they directly depend upon have changed.
This improves re-render time on some reflex-web
pages by 20x π
- [REF-889] useContext per substate by @masenf in #2149
- [REF-144] Add context in each component to prevent rerenders by @masenf in #2198
- Memoize markdown component_map by @masenf in #2219
- Support hooks in custom components (state, addEvents) by @masenf in #2234
- [reflex-web tweaks] Do not memoize children of InputGroup by @masenf in #2230
- [REF-1349] RechartsCharts and ResponsiveContainer must be memo leaf by @masenf in #2240
- Generalize MemoizationLeaf Component mixin (and apply to Cond and NextHead) by @masenf in #2247
- [REF-1352] Markdown component_map hash improvements by @masenf in #2241
Compiler
- _valid_children and _invalid_children accessible from class by @Lendemor in #2192
- Speed up reflex CLI imports by @picklelo in #2185
- Use singleton app provider to speed up compiles by @picklelo in #2172
Allow Multiple Subclasses of rx.State
Any module can now create substates without importing from a base state defined in the App.
Third-party components may define and use their own substates.
(Note: Working event handlers for substates defined within nested functions are still TODO.)
- REF-1052/rx.State as Base State by @ElijahAhianyo in #2146
Improved Basic HTML Elements
The rx.el
namespace provides access to basic HTML tags, such as a
, div
, and p
, which can be used to build the frontend instead of using Chakra components. This can be useful when styling the app via tailwind.
As Reflex moves to using radix-ui
components, this cleans up the API because many radix components directly inherit from basic HTML elements.
- HTML Refactor by @Alek99 in #2164
- [REF-1158] Move chakra-only deps to chakra lib by @masenf in #2171
Allow PIL images to be serialized in alternate formats
Setting the image.format
attribute on a PIL Image.Image
object controls what format the image is serialized as when sending to the frontend via data URI.
Add/Subtract time delta with rx.moment
Dependency Bumps
- pyproject.toml: upgrade httpx to 0.25.0 by @arnomoonens in #2013
- Upgrade to bun 1.0.13 by @picklelo in #2202
- REF-1202: Upgrade bun version if it differs from reflex set version by @ElijahAhianyo in #2206
Other Improvements
Bugfixes
Fix _hover
, _focus
and other leading underscore props
- Fix Prop conversion to camel case by @ElijahAhianyo in #2205
Others
- fix name for import var when is default and add tests by @Lendemor in #2214
- code_block responds to color mode by default by @masenf in #2228
Data Editor
- fix offset of data_editor input when page is scrolled by @Lendemor in #2208
- update column select literals by @tgberkeley in #2150
Internal
- check_generated_pyi: fix diff checking by @masenf in #2029
- keep app id (project hash) the same even after re-init by @tgberkeley in #2195
- Fix pyright errors by @picklelo in #2210
- Separate out the hosting CLI from main repo by @martinxu9 in #2165
- fix: fixes the command used for cloning the repo by @ankur0904 in #2159
New Contributors
- @arnomoonens made their first contribution in #2013
- @ankur0904 made their first contribution in #2159
Full Changelog: v0.3.4...v0.3.5
v0.3.4
This release re-exposes top level names under the reflex
namespace that were erroneously removed in v0.3.3
New Features
What's Changed
- Add chat icon by @Alek99 in #2181
- Hosting CLI: remove requirements generation when init, add back timeout for deploy command, remove deploy legacy command by @martinxu9 in #2179
- add in new no_of_lines prop for text by @tgberkeley in #2184
- Apply new pyi script by @Lendemor in #2041
- Fix missing lazy imports by @picklelo in #2187
- reflex_init_in_docker_test: export both frontend and backend by @masenf in #2182
- Fix wrong modal sizes by @Alek99 in #2183
- Bump to v0.3.4 by @picklelo in #2193
Full Changelog: v0.3.3...v0.3.4
v0.3.3 [yanked]
New Features
Python 3.12 is now supported
Next.js upgrade from 13 to 14
Clear Form using reset_on_submit
prop
You can use the reset_on_submit
on a form to reset form values to their original states after submitting the form. Simply set the value to True.
rx.form(
rx.input(id="text", placeholder="text"),
rx.button("Submit", type_="submit"),
reset_on_submit=True,
)
Forms support dynamic names.
-
Dynamic refs / ids don't really work but you can use dynamicΒ names instead
rx.form( rx.vstack( rx.input(name="name_input"), rx.hstack(rx.pin_input(length=4, name="pin_input")), rx.number_input(name="number_input"), rx.checkbox(name="bool_input"), rx.switch(name="bool_input2"), rx.slider(name="slider_input"), rx.range_slider(name="range_input"), rx.radio_group(["option1", "option2"], name="radio_input"), rx.select(["option1", "option2"], name="select_input"), rx.text_area(name="text_area_input"), rx.input( name="debounce_input", debounce_timeout=0, on_change=rx.console_log, ), rx.button("Submit", type_="submit"), ), ),
-
Use
rx.Var.range
(similar to pythonβsrange
) withrx.foreach
to dynamically create form elements with dynamic names.rx.Var.range(v1, v2, step)
takes in start, end and step values which should be integers orVar
integers.class State: grid: int = 4 def handle_submit(self, form_data: dict): print(form_data) rx.form( rx.responsive_grid( rx.foreach( rx.Var.range(State.grid), lambda i: rx.foreach( rx.Var.range(State.grid), lambda j: rx.input( name=f"grid_{i}_{j}", placeholder=f"grid {i} {j}", key=f"{i}_{j}", width="4em", ), ), ), columns=[State.grid], ), rx.button("Submit", type_="submit"), reset_on_submit=True, on_submit=State.handle_submit, ),
New form-based code should prefer to use the name
attribute to avoid the overhead of using refs for no specific gain (unless focus or value setting is required).
Improvements
- Assume secure protocol (wss://) and no port If the frontend is being accessed via
HTTPS
and theAPI_URL
is eitherlocalhost
,0.0.0.0
or::
and uses a non-secure protocol by @masenf in #2129 - Reduce Syntax highlighter footprint by @ElijahAhianyo in #2037
- Lazy import modules in reflex by @picklelo in #2144
Doc fixups
- fix: grammatical errors & typo in Spanish [readme.md](http://readme.md/) by @cllatser in #2139
- docs: remove duplicated content in [CONTRIBUTING.md](http://contributing.md/) by @Jaspreet-singh-1032 in #2152
- docs: revise typo in korean README and common CONTRIBUTING readme by @young-hun-jo in #2160
Bug Fixes
- fix an issue where some fields in
State.router.headers
were not getting updated by @Lendemor in #2133 - Resolve peer dependency conflict causing package-lock.json to relock on every run by @ElijahAhianyo in #2106
Other Changes
New Contributors
- @cllatser made their first contribution in #2130
- @Jaspreet-singh-1032 made their first contribution in #2152
- @young-hun-jo made their first contribution in #2160
Full Changelog: v0.3.2...0.3.3
v0.3.2
Thank you to our wonderful users and contributors! π π
New Features
Expose stop_propagation
and prevent_default
on Event Handlers
When an event trigger should not propagate to DOM elements nested below it use .stop_propagation
.
When an event action should override the browser default (like following a link), use .prevent_default
.
Each of these "event actions" will trigger the frontend to call the corresponding method on the DOM event associated with the event trigger. Both actions may be applied to the same event handler.
- Expose DOM event actions on EventHandler, EventSpec, and EventChain (stopPropagation) by @masenf in #1891
- Do not stop prop is there is no prop to stop by @masenf in #2116
Gunicorn Worker Class
The gunicorn_worker_class
may be specified in rxconfig.py
to configure low-level uvicorn settings when running in prod
mode. See example in dicussion #2070.
Components can be passed as props
Components can now accept props with type Var[Component]
, which allows for greater customization of components and greater flexibility when wrapping third-party components.
This only works for static components passed at compile-time. Components cannot be used in a State Var.
Github Codespaces
Creating a codespace from the reflex repo is now supported. Be sure to open the Backend URL in the browser first (or mark the port as Public) to allow the frontend to access the backend via websocket.
Improvements
Add orientation
prop to rx.stepper
Add column resize for data editor
Doc fixups
- fix: Typo in README.md by @debajoti in #2069
- fix: Grammatical error & typo in CONTRIBUTING.md by @debajoti in #2072
- docs: fixed wrapping react link by @Shreyas0410 in #2097
- Added links for Github issues and contributing.md file by @Sentious in #2076
- DALL E and API docs by @krishvsoni in #2082
- Typos fixed in multiple files by @SandeshPyakurel in #2090
- Fix readme links by @picklelo in #2118
Template Improvements
- base: expand template content to right edge of screen by @masenf in #2104
- Use blank template as default by @picklelo in #2109
- Prompt for template on reflex init by @picklelo in #2122
Hosting Service CLI
- [REF-1042] Hosting CLI: check the user selected app name by @martinxu9 in #2102
- Hosting CLI: use http endpoint to return deploy milestones by @martinxu9 in #2085
Other Improvements
- pyproject.toml: bump typer to 0.9.0 by @masenf in #2068
- cleanup dataeditor js code and hooks by @Lendemor in #2095
- rx.call_script callback needs to await promises by @masenf in #2121
Bug Fixes
- fix docker example by @dodeca-6-tope in #2086
- fix portal when using multiple dataeditor by @Lendemor in #2094
- make download work for state vars by @Lendemor in #2092
- Set unique index vars in rx.foreach by @picklelo in #2126
README Translations
- Added Spanish Readme by @bryan-trz in #2028
New Contributors
- @debajoti made their first contribution in #2069
- @dodeca-6-tope made their first contribution in #2086
- @Shreyas0410 made their first contribution in #2097
- @Sentious made their first contribution in #2076
- @krishvsoni made their first contribution in #2082
- @SandeshPyakurel made their first contribution in #2090
- @shu-qian made their first contribution in #2089
- @bryan-trz made their first contribution in #2028
Full Changelog: v0.3.1...v0.3.2