import React, { useRef } from "react"; import { useTabList, useTab, useTabPanel } from "@react-aria/tabs"; import { Item } from "@react-stately/collections"; import { useTabListState } from "@react-stately/tabs"; import styles from "./Tabs.module.css"; import classNames from "classnames"; export function TabContainer(props) { const state = useTabListState(props); const ref = useRef(); const { tabListProps } = useTabList(props, state, ref); return (
); } function Tab({ item, state }) { const { key, rendered } = item; const ref = useRef(); const { tabProps } = useTab({ key }, state, ref); return (
  • {rendered}
  • ); } function TabPanel({ state, ...props }) { const ref = useRef(); const { tabPanelProps } = useTabPanel(props, state, ref); return (
    {state.selectedItem?.props.children}
    ); } export const TabItem = Item;