diff --git a/MIGRATION.md b/MIGRATION.md index 5cb84c39887f..98e966e483b5 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -2,6 +2,7 @@ - [From version 6.4.x to 6.5.0](#from-version-64x-to-650) - [React18 new root API](#react18-new-root-api) + - [Renamed isToolshown to showToolbar](#renamed-istoolshown-to-showtoolbar) - [Deprecated register.js](#deprecated-registerjs) - [Dropped support for addon-actions addDecorators](#dropped-support-for-addon-actions-adddecorators) - [Vite builder renamed](#vite-builder-renamed) @@ -213,6 +214,21 @@ module.exports = { }; ``` +### Renamed isToolshown to showToolbar + +Storybook's [manager API](docs/addons/addons-api.md) has deprecated the `isToolshown` option (to show/hide the toolbar) and renamed it to `showToolbar` for consistency with other similar UI options. + +Example: + +```js +// .storybook/manager.js +import { addons } from '@storybook/addons'; + +addons.setConfig({ + showToolbar: false, +}); +``` + ### Deprecated register.js In ancient versions of Storybook, addons were registered by referring to `addon-name/register.js`. This is going away in SB7.0. Instead you should just add `addon-name` to the `addons` array in `.storybook/main.js`. diff --git a/docs/snippets/common/storybook-config-layout.js.mdx b/docs/snippets/common/storybook-config-layout.js.mdx index 41c1197ef8ca..c36446aebea2 100644 --- a/docs/snippets/common/storybook-config-layout.js.mdx +++ b/docs/snippets/common/storybook-config-layout.js.mdx @@ -18,11 +18,11 @@ addons.setConfig({ collapsedRoots: ['other'], }, toolbar: { - title: { hidden: false, }, - zoom: { hidden: false, }, - eject: { hidden: false, }, - copy: { hidden: false, }, - fullscreen: { hidden: false, }, + title: { hidden: false }, + zoom: { hidden: false }, + eject: { hidden: false }, + copy: { hidden: false }, + fullscreen: { hidden: false }, }, }); -``` \ No newline at end of file +``` diff --git a/lib/api/src/modules/layout.ts b/lib/api/src/modules/layout.ts index e5133da9f305..3fba1905012c 100644 --- a/lib/api/src/modules/layout.ts +++ b/lib/api/src/modules/layout.ts @@ -3,6 +3,8 @@ import pick from 'lodash/pick'; import deepEqual from 'fast-deep-equal'; import { themes } from '@storybook/theming'; import type { ThemeVars } from '@storybook/theming'; +import { once } from '@storybook/client-logger'; +import dedent from 'ts-dedent'; import merge from '../lib/merge'; import type { State, ModuleFn } from '../index'; @@ -25,7 +27,10 @@ export interface Layout { showNav: boolean; showTabs: boolean; showToolbar: boolean; - isToolshown?: boolean; // deprecated + /** + * @deprecated + */ + isToolshown?: boolean; } export interface UI { @@ -222,6 +227,11 @@ export const init: ModuleFn = ({ store, provider, singleStory }) => { const { theme, selectedPanel, ...options } = provider.getConfig(); if (options?.layout?.isToolshown !== undefined) { + once.warn(dedent` + The "isToolshown" option is deprecated. Please use "showToolbar" instead. + + See https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#renamed-istoolshown-to-showtoolbar + `); options.layout.showToolbar = options.layout.isToolshown; }