11import React , { useState } from 'react' ;
22import { Source } from '@storybook/blocks' ;
3+ import './CodeTabs.css' ;
34
45interface CodeTabsProps {
5- /** JSX/TSX code snippet for the React tab */
6- react : string ;
6+ /**
7+ * @deprecated — React tab now uses SourceType.DYNAMIC to show live story code
8+ * that updates with Controls. This prop is kept for backward compatibility but ignored.
9+ */
10+ react ?: string ;
711 /** HTML/CSS markup snippet for the HTML/CSS tab */
812 html : string ;
913}
@@ -16,9 +20,11 @@ type Tab = 'react' | 'html';
1620 * - HTML/CSS tab: shows the equivalent vanilla HTML markup
1721 *
1822 * Syntax highlighting via Storybook's built-in Source block from @storybook/blocks.
23+ * The React tab uses Source without explicit type (defaults to AUTO, which resolves to
24+ * DYNAMIC for stories with args). This shows live story code and updates with Controls.
1925 * The tab bar uses design token CSS variables so it responds to dark mode.
2026 */
21- export function CodeTabs ( { react , html } : CodeTabsProps ) {
27+ export function CodeTabs ( { html } : CodeTabsProps ) {
2228 const [ activeTab , setActiveTab ] = useState < Tab > ( 'react' ) ;
2329
2430 const tabBarStyle : React . CSSProperties = {
@@ -54,7 +60,7 @@ export function CodeTabs({ react, html }: CodeTabsProps) {
5460 } ;
5561
5662 return (
57- < div >
63+ < div className = "dsn-code-tabs" >
5864 < div style = { tabBarStyle } >
5965 < button
6066 type = "button"
@@ -75,7 +81,7 @@ export function CodeTabs({ react, html }: CodeTabsProps) {
7581 </ div >
7682 < div style = { codeWrapperStyle } >
7783 { activeTab === 'react' ? (
78- < Source code = { react } language = "tsx" dark />
84+ < Source dark />
7985 ) : (
8086 < Source code = { html } language = "html" dark />
8187 ) }
0 commit comments