From 5582082a8b0a3a17a104f88cd7f4e2d7b6cc38b6 Mon Sep 17 00:00:00 2001 From: Loris Fauster Date: Mon, 23 Nov 2026 19:21:37 +0100 Subject: [PATCH] theme/TabItem: fix examples content not rendering after Docusaurus upgrade Since the upgrade to Docusaurus 3.10 (bd774b8), no longer passes a `hidden` prop to its children; the original TabItem instead derives its selection state from its own `value` prop and the tabs context. Our wrapper stripped `value` before passing props on, so no TabItem was ever considered selected and all blueprint examples were hidden. Derive `hidden` via useTabs() instead, and always pass the selected value to the original TabItem so it never renders the `hidden` attribute. useTabs() is an internal Docusaurus API, but TabItem is not marked as safe to swizzle anyway [1], so this needs re-checking on upgrades either way. [1] https://docusaurus.io/docs/swizzling --- src/theme/TabItem/index.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/theme/TabItem/index.tsx b/src/theme/TabItem/index.tsx index 91055fe99b0..b3e0c55f83a 100644 --- a/src/theme/TabItem/index.tsx +++ b/src/theme/TabItem/index.tsx @@ -1,6 +1,7 @@ import React from 'react'; import TabItem from '@theme-original/TabItem'; import type {WrapperProps} from '@docusaurus/types'; +import {useTabs} from '@docusaurus/theme-common/internal'; import styles from './styles.module.css'; type Props = WrapperProps; @@ -9,7 +10,10 @@ type Props = WrapperProps; // uses https://docusaurus.io/docs/swizzling#wrapping // to wrap the original TabItem component and add a contextual label based on the tab value export default function TabItemWrapper(props: Props): JSX.Element { - const {hidden, value, ...otherProps} = props; + const {value} = props; + // Docusaurus >= 3.10 no longer passes `hidden`; derive it from the tabs context + const {selectedValue} = useTabs(); + const hidden = value !== selectedValue; // Generate contextual label based on tab value const getContextLabel = (tabValue: string) => { @@ -29,7 +33,8 @@ export default function TabItemWrapper(props: Props): JSX.Element {
{getContextLabel(value)}
- + {/* always "selected" so TabItem never sets the `hidden` attribute */} + ); }