import React, { ReactElement } from "react"; import Icon, { IconProp } from "../icon"; import { ControlsProps } from "../../common/controls.type"; import classNames from "classnames"; import { TabUnderlineStyle } from "../tabs"; export interface TabProps extends Omit { icon?: IconProp; suffixIcon?: IconProp; prefix?: ReactElement; suffix?: ReactElement; label: string | IconProp | ReactElement; children: ReactElement; active?: boolean; onClick?: () => void; expanded?: boolean; underlineStyle?: TabUnderlineStyle; } const Tab = ({ label, icon, suffixIcon, prefix, suffix, active, disabled, onClick, expanded, underlineStyle, }: TabProps) => { const handleClick = () => { if (disabled || !onClick) { return; } onClick(); }; return (
{prefix} {icon && } {label} {suffixIcon && } {suffix}
); }; export default Tab;