diff --git a/website/src/pages/tabs.mdx b/website/src/pages/tabs.mdx index 86f029c66..6f7997fd5 100644 --- a/website/src/pages/tabs.mdx +++ b/website/src/pages/tabs.mdx @@ -763,28 +763,39 @@ With a little composition we can animate the selected tab bar. const HORIZONTAL_PADDING = 8; const AnimatedContext = React.createContext(); - function AnimatedTabs({ color, ...rest }) { + function AnimatedTabs({ color, children, ...rest }) { // some state to store the position we want to animate to const [activeRect, setActiveRect] = useState(null); + const ref = useRef(); + const rect = useRect(ref); return ( // put the function to change the styles on context so an active Tab // can call it, then style it up {/* make sure to forward props since we're wrapping Tabs */} - -
+ +
+ {children} + ); }