'use client'; import * as Ariakit from '@ariakit/react'; import React from 'react'; import MdTabTitle from './MdTabTitle'; import type { MdTabProps } from './MdTab'; import type { ReactNode } from 'react'; export interface MdTabsProps { children: React.ReactNode; initialTab?: number; chips?: boolean; chipsPrefixIcon?: ReactNode; compact?: boolean; } export const MdTabs: React.FunctionComponent = ({ children, initialTab = 0, chips = false, chipsPrefixIcon = false, compact = false, }: MdTabsProps) => { const tabs = React.Children.toArray(children).filter(React.isValidElement) as React.ReactElement[]; const selectedTab = initialTab > tabs.length - 1 || initialTab < 0 ? 0 : initialTab; return (
{tabs.map((item, index) => { return ( ); })}
{tabs.map((item, index) => { return ( {item.props.children} ); })}
); }; export default MdTabs;