'use client'; import * as Ariakit from '@ariakit/react'; import React from 'react'; import MdTabTitle from './MdTabTitle'; import type { MdTabProps } from './MdTab'; import type { ReactElement, ReactNode } from 'react'; export interface MdTabsProps { children: ReactElement[]; 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: ReactElement[] = children instanceof Array ? children : [children]; 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;