base-ui
base-ui copied to clipboard
[docs] Tabs examples with motion
https://github.com/mui/base-ui/issues/1494 https://github.com/mui/base-ui/issues/1486
Demo: https://deploy-preview-1613--base-ui.netlify.app/experiments/tabs/motion
- Used
mode="wait"on AnimatePresence, the entering child waits until the exiting child has animated out, othermodes should be possible, though extra display/positioning styles would be required (set via motion) to prevent overlap: - If using Tailwind v4, setting
hidden={undefined}onTabs.Panelis required to ensure the panel is visible during the exit animation (same workaround as Collapsible) - Replicating the indicator transition from the docs styles with motion turns out to be tricker than the panel, it can't seem to transition the same CSS variable that changes value:
// doesn't work even with the entries repeated in `initial`/`exit`
<Tabs.Indicator render={
<motion.div
animate={{
translate: 'var(--active-tab-left) -50%',
width: 'var(--active-tab-width)',
}}
/>
}
- [x] I have followed (at least) the PR section of the contributing guide.
Deploy Preview for base-ui ready!
| Name | Link |
|---|---|
| Latest commit | 6692c292c2585175c14080a0c62afe562c1c22bb |
| Latest deploy log | https://app.netlify.com/sites/base-ui/deploys/67ebb9e814ff670008af9c57 |
| Deploy Preview | https://deploy-preview-1613--base-ui.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
Closing this since motion has examples now