@cainiaofe/cn-ui-m
Version:
52 lines (51 loc) • 1.24 kB
TypeScript
import * as React from 'react';
import { CnTabItemProps } from './cn-tab-item-props';
export interface CnTabProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {
/**
* 类型区分
*/
type?: 'primary' | 'secondary';
/**
* 当前激活 tab 面板的 key
*/
activeKey?: string | number;
/**
* 初始化选中面板的 key,如果没有设置 activeKey 时生效
*/
defaultActiveKey?: string | number;
/**
* 数据源模式,在没有传入 children 时生效
*/
dataSource?: CnTabItemProps[];
/**
* 切换面板的回调
*/
onChange?: (key: string | number) => void;
/**
* 自定义渲染 tab 标题
*/
renderTab?: (props: {
title: React.ReactNode;
active: boolean;
}) => React.ReactNode;
/**
* 内容自定义样式名
*/
contentClassName?: string;
/**
* 内容自定义样式
*/
contentStyle?: React.CSSProperties;
/**
* 附加栏,可以追加筛选栏
*/
additionSlot?: React.ReactNode;
/**
* tab 项对齐方向
*/
tabAlign?: 'center' | 'left';
/**
* 导航栏附加内容
*/
extra?: React.ReactNode;
}