Support react 19 action props #3997
Unanswered
suneettipirneni
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Feature request
Overview
Radix Select and Switch should expose action-style props for user-driven value changes:
The existing synchronous callbacks, such as
onValueChangeandonCheckedChange, should continue to work for local state updates, analytics, and other synchronous observation. The action props are for changes that start async work, such as persistence, server mutations, async validation, or settings updates.When an action prop is used, the primitive should optimistically display the requested value immediately using React's optimistic update semantics, invoke the action in a transition, and guard against duplicate/conflicting interactions while that action is pending. Styling remains user-owned through data attributes such as
data-pendinganddata-optimistic; Radix should not prescribe loading visuals.Because this behavior depends on modern React action and optimistic update APIs, action props should fail fast when used outside React 19.2 or newer.
Examples in other libraries
useOptimistic: https://react.dev/reference/react/useOptimisticuseTransition: https://react.dev/reference/react/useTransitionWho does this impact? Who is this for?
This is for product teams building settings screens, dashboards, forms, and account-management flows where changing a Select or Switch often starts async work.
Without action props, users repeatedly bridge async work into primitives manually:
That works, but every app has to reimplement pending state, duplicate-interaction guards, optimistic feedback, and reconciliation. Moving the interaction boundary into the primitive gives users a consistent async path while preserving existing synchronous callbacks.
Additional context
This keeps Radix headless:
The initial scope can stay focused on value-changing primitives where delayed visual feedback feels broken, starting with Select and Switch.
Beta Was this translation helpful? Give feedback.
All reactions