๐ BIG NEWS ๐ โฆ Avo 4 has officially SHIPPED โฆ ๐ the beta is over, 4.0 is here โฆ ๐ ๏ธ build admin panels, dashboards & internal tools at light speed โฆ โญ you are visitor #1,136,516 โฆ ๐ tell a friend โฆ best viewed in Ruby on Rails โฆ ๐ click here to see what’s new โฆ
Reactive Fields
Create smart forms where fields update based on user input.
# $40/mo
gem "avo-reactive_fields"
Let one field respond to another as your users type. Reactive Fields adds a
react_on
option to any Avo field, so a city select can repopulate when the country
changes, a slug can fill itself from a name, and a price can recompute the
moment a quantity is edited, all on the same form. It's all plain Ruby, no
JavaScript to write and no Stimulus controller to wire up.
When a watched field changes, the form posts itself back over Turbo and Avo
re-renders only the reacting fields. Point a field at one dependency, a list,
or every field on the form with react_on: :all,
then derive its value with a format_using
or options
lambda that reads the current @record.
Dependent forms like that are fiddly to wire and easy to break on the next
Avo upgrade. This is a gem you add, not a piece of front-end plumbing you
build and then maintain.
What you get
-
Wire a dependent form in one line: add
react_onto any field, point it at one field, a list, or:all, and skip the Stimulus controller - Cascading selects that stay in sync: a city dropdown that repopulates the moment the country changes, no stale options
-
Fields that fill themselves: derive a slug, a total, or a price with a
format_usinglambda the instant its source changes -
Your lambdas always see the form as the user left it,
@recordcarries the latest values on every update, so derived values are never one edit behind -
Compare against what changed: original values stay available through Rails'
*_wasmethods - Reacts on the right event for you, selects and checkboxes on change, text inputs on debounced input, so it feels instant without firing on every keystroke
Why it pays off
-
Ship a dependent form this afternoon with one
react_online, instead of writing and debugging your own Stimulus and Turbo wiring. -
Reactive forms are easy to get subtly wrong: stale
@recordstate, options that do not refresh, fields that fire on the wrong event. That is our code to keep correct, not yours. - Every Avo release makes it better: the reactive behavior gains improvements and the field options you rely on keep working through upgrades, without you patching it.
- One less piece of admin plumbing for your team to build, document, and support.
Recent releases
- 1.0.0
# included in
# ready to ship?
You ship it this afternoon. We keep it solid for years.