Skip to content

Commit

Permalink
pick renderActiveTabPanelOnly prop
Browse files Browse the repository at this point in the history
  • Loading branch information
bvandercar-vt committed Jul 16, 2024
1 parent 8f202ae commit fc9d945
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/core/src/components/tabs/tabPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@ import * as React from "react";
import { AbstractPureComponent, Classes, Utils } from "../../common";

import { type TabProps } from "./tab";
import type { TabsProps } from "./tabs";
import { generateTabIds, type TabTitleProps } from "./tabTitle";

export interface TabPanelProps extends Pick<TabProps, "className" | "id" | "panel">, Pick<TabTitleProps, "parentId"> {
export interface TabPanelProps
extends Pick<TabProps, "className" | "id" | "panel">,
Pick<TabsProps, "renderActiveTabPanelOnly">,
Pick<TabTitleProps, "parentId"> {
/**
* Used for setting `aria-hidden` prop.
*/
Expand All @@ -34,9 +38,9 @@ export interface TabPanelProps extends Pick<TabProps, "className" | "id" | "pane
*/
export class TabPanel extends AbstractPureComponent<TabPanelProps> {
public render() {
const { className, id, parentId, panel, isHidden } = this.props;
const { className, id, parentId, panel, isHidden, renderActiveTabPanelOnly } = this.props;

if (panel === undefined) {
if (panel === undefined || (renderActiveTabPanelOnly && isHidden)) {
return undefined;
}

Expand Down

0 comments on commit fc9d945

Please sign in to comment.