-
-
Notifications
You must be signed in to change notification settings - Fork 73
Description
Is your feature request related to a problem? Please describe.
Compared to other headless UI libraries like Radix (which supports asChild
), RAC does not allow rendering its components as custom components. While this design choice makes sense, it introduces limitations particularly around client-side routing and prefetching.
This issue is discussed in detail here. The TL;DR: TanStack Router performs prefetching via its own Link
component, which is incompatible with RAC's Link
component by default. The proposed solution is to bypass RAC’s built-in Link
entirely and instead implement it manually using hooks from the react-aria
library.
Describe the solution you'd like
I’d like this library to include a built-in RAC/TanStack Router-compatible Link
component implemented via hooks, as described in the TanStack documentation. Ideally, this could be enabled through a setting in components.json
, e.g., "framework": "tanstack"
.
Enabling this setting would:
- Replace the default
Link
component with the TanStack-compatible version - Update other components (e.g., sidebar) to use this version accordingly
This is necessary because the TanStack-compatible Link
has a different API surface and cannot be used as a drop-in replacement.
Describe alternatives you've considered
As outlined in the above linked issue, there are currently no real alternatives. RAC has made it clear that it won’t adopt an asChild
-style API like Radix. The only other option is to forgo prefetching entirely which is a significant drawback, especially given that prefetching is a major selling point of using TanStack Router.