This moves the collection implementation used by React Aria Components into a new package (@react-aria/collections), enabling it to be used in other React Aria hook-based libraries like NextUI. This includes:
CollectionBuilder
Collection
createBranchComponent and createLeafComponent
createHideableComponent and useIsHidden (new hook)
useCachedChildren
BaseCollection and NodeValue classes, to enable subclassing. I did not move TableCollection out of RAC here. Should we consider that?
Code has been split into multiple files for readability as well.
What's not moving:
The collection renderer system, which is more specific to RAC.
The Section component, and other specific collection components.
@react-stately/collections (the old collection implementation) will remain unchanged and continue to work. In the future, we may deprecate it once we update all of the documentation examples. Short term, @react-aria/collections will be in a pre-release state, enabling libraries to test it out and provide feedback.
@react-aria/collections is in React Aria rather than React Stately because it relies on react-dom for portals. React Native users will either need to continue using @react-stately/collections or find a new way to implement collections that's specific to React Native.
This moves the collection implementation used by React Aria Components into a new package (
@react-aria/collections
), enabling it to be used in other React Aria hook-based libraries like NextUI. This includes:CollectionBuilder
Collection
createBranchComponent
andcreateLeafComponent
createHideableComponent
anduseIsHidden
(new hook)useCachedChildren
BaseCollection
andNodeValue
classes, to enable subclassing. I did not moveTableCollection
out of RAC here. Should we consider that?Code has been split into multiple files for readability as well.
What's not moving:
Section
component, and other specific collection components.@react-stately/collections
(the old collection implementation) will remain unchanged and continue to work. In the future, we may deprecate it once we update all of the documentation examples. Short term,@react-aria/collections
will be in a pre-release state, enabling libraries to test it out and provide feedback.@react-aria/collections
is in React Aria rather than React Stately because it relies onreact-dom
for portals. React Native users will either need to continue using@react-stately/collections
or find a new way to implement collections that's specific to React Native.