Open
Description
So I tried to use it similar way as Radix, but it's doesn't work
"use client"
import * as React from "react"
import { useState } from "react"
import { Tabs } from "@base-ui-components/react/tabs"
import { AnimatePresence, motion } from "motion/react"
export function NewTabsDemo() {
const [active, setActive] = useState("one")
return (
<Tabs.Root value={active} onValueChange={setActive} defaultValue="one">
<Tabs.List>
<Tabs.Tab value="one">One</Tabs.Tab>
<Tabs.Tab value="two">Two</Tabs.Tab>
<Tabs.Tab value="three">Three</Tabs.Tab>
</Tabs.List>
<AnimatePresence mode="popLayout">
{active === "one" && (
<Tabs.Panel
className="bg-red-500 p-12"
value="one"
keepMounted
render={
<motion.div
initial={{
opacity: 0,
y: -100,
}}
animate={{
opacity: 1,
y: 0,
}}
exit={{
opacity: 0,
y: 100,
}}
/>
}
>
one
</Tabs.Panel>
)}
{active === "two" && (
<Tabs.Panel
keepMounted
className="bg-green-500 p-12"
value="two"
render={
<motion.div
initial={{
opacity: 0,
y: -100,
}}
animate={{
opacity: 1,
y: 0,
}}
exit={{
opacity: 0,
y: 100,
}}
/>
}
>
two
</Tabs.Panel>
)}
{active === "three" && (
<Tabs.Panel
keepMounted
className="bg-yellow-500 p-12"
value="three"
render={
<motion.div
initial={{
opacity: 0,
y: -100,
}}
animate={{
opacity: 1,
y: 0,
}}
exit={{
opacity: 0,
y: 100,
}}
/>
}
>
three
</Tabs.Panel>
)}
</AnimatePresence>
</Tabs.Root>
)
}
I haven't found a single examples of usage with Motion.