import classNames from "classnames"; import * as React from "react"; import * as Classes from "../../common/classes"; import { DISPLAYNAME_PREFIX, HTMLDivProps, IProps } from "../../common/props"; export type TabId = string | number; export interface ITabProps extends IProps { /** * Content of tab title, rendered in a list above the active panel. * Can also be set via the `title` prop. */ children?: React.ReactNode; /** * Whether the tab is disabled. * @default false */ disabled?: boolean; /** * Header props */ headerProps?: IProps & HTMLDivProps; /** * Unique identifier used to control which tab is selected * and to generate ARIA attributes for accessibility. */ id: TabId; /** * Panel content, rendered by the parent `Tabs` when this tab is active. * If omitted, no panel will be rendered for this tab. */ panel?: JSX.Element; /** * Content of tab title element, rendered in a list above the active panel. * Can also be set via React `children`. */ title?: React.ReactNode; } export class Tab extends React.PureComponent { public static defaultProps: ITabProps = { disabled: false, id: undefined, }; public static displayName = `${DISPLAYNAME_PREFIX}.Tab`; // this component is never rendered directly; see Tabs#renderTabPanel() /* istanbul ignore next */ public render() { const { className, panel } = this.props; return (
{panel}
); } }