import { Key, ReactElement } from 'react'; import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types'; import { TabItemProps } from './TabItem'; export type TabsChild = ReactElement; export interface TabProps extends Omit, 'onChange' | 'children'> { /** * Current TabItem's index */ activeKey?: Key; /** * The TabItems in tab */ children: TabsChild | TabsChild[]; /** * Initial active TabItem's key, if activeKey is not set. */ defaultActiveKey?: Key; /** * The direction of tab * @default 'horizontal' */ direction?: 'horizontal' | 'vertical'; /** * The change event handler of Tab */ onChange?: (activeKey: Key, index: number) => void; /** * The size of tab, controls padding around the tab group. * main: padding-horizontal-spacious + padding-vertical-spacious (top only) * sub: no padding * @default 'main' */ size?: 'main' | 'sub'; } /** * 頁籤導航元件,透過底部滑動指示條標示當前選取的頁籤。 * * 以 `TabItem` 作為子元件定義每個頁籤項目,支援水平(`horizontal`)與垂直(`vertical`) * 兩種排列方向。可透過 `activeKey`(受控)或 `defaultActiveKey`(非受控)指定當前頁籤, * `onChange` 回呼在切換時接收新的 `activeKey` 與索引。 * * @example * ```tsx * import Tab from '@mezzanine-ui/react/Tab'; * import TabItem from '@mezzanine-ui/react/TabItem'; * * // 基本用法(非受控) * * 首頁 * 個人資料 * 設定 * * * // 受控用法 * const [activeKey, setActiveKey] = useState('tab1'); * setActiveKey(key)}> * 頁籤一 * 頁籤二 * * * // 垂直方向 * * 分類 A * 分類 B * * ``` * * @see {@link TabItem} 頁籤項目元件 */ declare const Tab: import("react").ForwardRefExoticComponent>; export default Tab;