diff --git a/examples/storybook-5/.storybook/preview.js b/examples/storybook-5/.storybook/preview.js
index fbd0a1d7c..394e22b3c 100644
--- a/examples/storybook-5/.storybook/preview.js
+++ b/examples/storybook-5/.storybook/preview.js
@@ -1,7 +1,7 @@
import React from 'react'
import { addDecorator, addParameters } from '@storybook/react';
import { ThemeProvider, BlockContextProvider } from '@component-controls/storybook';
-import { ControlsTable, Title, Subtitle, Story, Stories, Description, StorySource, ComponentSource, PropsTable } from '@component-controls/blocks';
+import { ControlsTable, Title, Subtitle, Story, Playground, Stories, Description, StorySource, ComponentSource, PropsTable } from '@component-controls/blocks';
addDecorator((story, ctx ) => {
return (
@@ -20,8 +20,9 @@ export const DocsPage = () => {
-
-
+
+
+
diff --git a/ui/blocks/src/Playground/Playground.stories.tsx b/ui/blocks/src/Playground/Playground.stories.tsx
index 9281a7d0a..d8e67ed3d 100644
--- a/ui/blocks/src/Playground/Playground.stories.tsx
+++ b/ui/blocks/src/Playground/Playground.stories.tsx
@@ -16,6 +16,14 @@ export const overview = () => (
);
+export const defaultOpenSource = () => (
+
+
+
+
+
+);
+
export const disableZoomPan = () => (
;
@@ -74,10 +78,12 @@ export const Playground: FC = ({
transform,
actions: userActions = [],
children,
+ openTab,
}) => {
const [tabsIndex, setTabsIndex] = React.useState(
undefined,
);
+
const childStories = <>{children}>;
const zoomEnabled = !transform?.options?.disabled;
@@ -94,6 +100,11 @@ export const Playground: FC = ({
});
}
const panels: ActionItems = getSortedPanels(userActions);
+
+ React.useEffect(() => {
+ const index = panels.findIndex((p: ActionItem) => p.title === openTab);
+ setTabsIndex(index > -1 ? index : undefined);
+ }, [openTab]);
const panelActions = userActions.map((panel: ActionItem) => {
return panel.panel
? {