Skip to content

Conversation

@devongovett
Copy link
Member

Adding on to the SelectionIndicator animations we released recently, this enables animating between TabPanels in React Aria Components. TabPanel now has data-entering and data-exiting states, which enable implementation of transitions like cross fades or slides.

In addition, a new <TabPanels> component (plural) provides CSS variables for the width and height of the active tab panel, similar to the ones we added to Disclosure. This allows smoothly transitioning the height when switching between tabs. It accepts the collection API, so for dynamic tabs it replaces the need for the <Collection> component.

@rspbot
Copy link

rspbot commented Oct 21, 2025

@rspbot
Copy link

rspbot commented Oct 21, 2025

## API Changes

react-aria-components

/react-aria-components:TabPanelRenderProps

 TabPanelRenderProps {
+  isEntering: boolean
+  isExiting: boolean
   isFocusVisible: boolean
   isFocused: boolean
   isInert: boolean
   state: TabListState<unknown>

/react-aria-components:TabPanels

+TabPanels <T extends {}> {
+  children?: ReactNode | ({}) => ReactNode
+  className?: string = 'react-aria-TabPanels'
+  dependencies?: ReadonlyArray<any>
+  disabledKeys?: Iterable<Key>
+  items?: Iterable<{}>
+  style?: CSSProperties
+}

/react-aria-components:TabPanelsProps

+TabPanelsProps <T> {
+  children?: ReactNode | (T) => ReactNode
+  className?: string = 'react-aria-TabPanels'
+  dependencies?: ReadonlyArray<any>
+  disabledKeys?: Iterable<Key>
+  items?: Iterable<T>
+  style?: CSSProperties
+}

Copy link
Member

@snowystinger snowystinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really nice on the vanilla example. It appears we can do this animation now without needing the force mount? but I assume you still need that to do a slide transition

@devongovett devongovett added this pull request to the merge queue Oct 24, 2025
Merged via the queue into main with commit e2a44bc Oct 24, 2025
32 checks passed
@devongovett devongovett deleted the tabpanel-animation branch October 24, 2025 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants