diff --git a/code/addons/controls/src/ControlsPanel.tsx b/code/addons/controls/src/ControlsPanel.tsx index 80feaa374b51..c87d074035b7 100644 --- a/code/addons/controls/src/ControlsPanel.tsx +++ b/code/addons/controls/src/ControlsPanel.tsx @@ -34,6 +34,7 @@ interface ControlsParameters { sort?: SortType; expanded?: boolean; presetColors?: PresetColor[]; + disableSave?: boolean; } interface ControlsPanelProps { @@ -46,7 +47,12 @@ export const ControlsPanel = ({ saveStory, createStory }: ControlsPanelProps) => const [args, updateArgs, resetArgs, initialArgs] = useArgs(); const [globals] = useGlobals(); const rows = useArgTypes(); - const { expanded, sort, presetColors } = useParameter(PARAM_KEY, {}); + const { + expanded, + sort, + presetColors, + disableSave = false, + } = useParameter(PARAM_KEY, {}); const { path, previewInitialized } = useStorybookState(); // If the story is prepared, then show the args table @@ -84,9 +90,10 @@ export const ControlsPanel = ({ saveStory, createStory }: ControlsPanelProps) => sort={sort} isLoading={isLoading} /> - {hasControls && hasUpdatedArgs && global.CONFIG_TYPE === 'DEVELOPMENT' && ( - - )} + {hasControls && + hasUpdatedArgs && + global.CONFIG_TYPE === 'DEVELOPMENT' && + disableSave !== true && } ); }; diff --git a/docs/essentials/controls.mdx b/docs/essentials/controls.mdx index 3c249c058e04..271cd3e17aaf 100644 --- a/docs/essentials/controls.mdx +++ b/docs/essentials/controls.mdx @@ -260,6 +260,12 @@ You can also update a control's value, then save the changes to the story. The s