Skip to content
14 changes: 10 additions & 4 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,6 @@ export const MyStory = {
};
```


### API and Component Changes

#### Button Component API Changes
Expand Down Expand Up @@ -908,6 +907,15 @@ The package `@storybook/blocks` is no longer published as of Storybook 9.

All exports can now be found in the export `@storybook/addon-docs/blocks`.

Previously, you were able to import all blocks from `@storybook/addon-docs`, this is no longer the case.

This is the only correct import path:

```diff
- import { Meta } from "@storybook/addon-docs";
+ import { Meta } from "@storybook/addon-docs/blocks";
```

### Configuration and Type Changes

#### Manager builder removed alias for `util`, `assert` and `process`
Expand All @@ -920,7 +928,6 @@ Adding these aliases meant storybook core, had to depend on these packages, whic

If you addon fails to load after this change, we recommend looking at implementing the alias at compile time of your addon, or alternatively look at other bundling config to ensure the correct entries/packages/dependencies are used.


#### Type System Updates

The following types have been removed:
Expand All @@ -943,7 +950,6 @@ Deprecated getters have been removed from the CsfFile class:
- `_fileName`
- `_makeTitle`


#### React-Native config dir renamed

In Storybook 9, React Native (RN) projects use the `.rnstorybook` config directory instead of `.storybook`.
Expand Down Expand Up @@ -1105,7 +1111,7 @@ To enable it, just set the feature flag in your `.storybook/main.<js|ts> file.
```tsx
export default {
features: {
angularFilterNonInputControls: true
angularFilterNonInputControls: true,
},
// ... other configurations
};
Expand Down
44 changes: 22 additions & 22 deletions code/addons/docs/src/compiler/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ describe('full snapshots', () => {
});
it('canvas without story children', () => {
const input = dedent`
import { Canvas } from '@storybook/addon-docs';
import { Canvas } from '@storybook/addon-docs/blocks';

<Canvas>
<h2>Some here</h2>
Expand All @@ -279,7 +279,7 @@ describe('full snapshots', () => {
expect(compileSync(input)).toMatchInlineSnapshot(`
import {jsx as _jsx} from "react/jsx-runtime";
import {useMDXComponents as _provideComponents} from "@mdx-js/react";
import {Canvas} from '@storybook/addon-docs';
import {Canvas} from '@storybook/addon-docs/blocks';
function _createMdxContent(props) {
return _jsx(Canvas, {
children: _jsx("h2", {
Expand Down Expand Up @@ -308,7 +308,7 @@ describe('docs-mdx-compiler-plugin', () => {
expect(
clean(
compileSync(dedent`
import { Story, Meta, Canvas } from '@storybook/addon-docs';
import { Story, Meta, Canvas } from '@storybook/addon-docs/blocks';
import { Welcome, Button } from '@storybook/angular/demo';
import * as MyStories from './My.stories';
import { Other } from './Other.stories';
Expand All @@ -327,7 +327,7 @@ describe('docs-mdx-compiler-plugin', () => {
).toMatchInlineSnapshot(`
import {Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs} from "react/jsx-runtime";
import {useMDXComponents as _provideComponents} from "@mdx-js/react";
import {Story, Meta, Canvas} from '@storybook/addon-docs';
import {Story, Meta, Canvas} from '@storybook/addon-docs/blocks';
import {Welcome, Button} from '@storybook/angular/demo';
import * as MyStories from './My.stories';
import {Other} from './Other.stories';
Expand Down Expand Up @@ -358,7 +358,7 @@ describe('docs-mdx-compiler-plugin', () => {
expect(
clean(
compileSync(dedent`
import { Meta } from '@storybook/addon-docs';
import { Meta } from '@storybook/addon-docs/blocks';

<Meta title="docs-only" />

Expand All @@ -370,7 +370,7 @@ describe('docs-mdx-compiler-plugin', () => {
).toMatchInlineSnapshot(`
import {Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs} from "react/jsx-runtime";
import {useMDXComponents as _provideComponents} from "@mdx-js/react";
import {Meta} from '@storybook/addon-docs';
import {Meta} from '@storybook/addon-docs/blocks';
function _createMdxContent(props) {
const _components = {
h1: "h1",
Expand All @@ -395,15 +395,15 @@ describe('docs-mdx-compiler-plugin', () => {
expect(
clean(
compileSync(dedent`
import { Meta } from '@storybook/addon-docs';
import { Meta } from '@storybook/addon-docs/blocks';

<Meta title="Addons/Docs/what's in a title?" />
`)
)
).toMatchInlineSnapshot(`
import {jsx as _jsx} from "react/jsx-runtime";
import {useMDXComponents as _provideComponents} from "@mdx-js/react";
import {Meta} from '@storybook/addon-docs';
import {Meta} from '@storybook/addon-docs/blocks';
function _createMdxContent(props) {
return _jsx(Meta, {
title: "Addons/Docs/what's in a title?"
Expand All @@ -417,7 +417,7 @@ describe('docs-mdx-compiler-plugin', () => {
clean(
compileSync(dedent`
import { Button } from '@storybook/react/demo';
import { Story, Meta } from '@storybook/addon-docs';
import { Story, Meta } from '@storybook/addon-docs/blocks';

<Meta title="Button" />

Expand All @@ -432,7 +432,7 @@ describe('docs-mdx-compiler-plugin', () => {
import {Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs} from "react/jsx-runtime";
import {useMDXComponents as _provideComponents} from "@mdx-js/react";
import {Button} from '@storybook/react/demo';
import {Story, Meta} from '@storybook/addon-docs';
import {Story, Meta} from '@storybook/addon-docs/blocks';
export const two = 2;
function _createMdxContent(props) {
const _components = {
Expand All @@ -457,7 +457,7 @@ describe('docs-mdx-compiler-plugin', () => {
expect(
clean(
compileSync(dedent`
import { Story } from '@storybook/addon-docs';
import { Story } from '@storybook/addon-docs/blocks';

# Current story

Expand All @@ -467,7 +467,7 @@ describe('docs-mdx-compiler-plugin', () => {
).toMatchInlineSnapshot(`
import {Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs} from "react/jsx-runtime";
import {useMDXComponents as _provideComponents} from "@mdx-js/react";
import {Story} from '@storybook/addon-docs';
import {Story} from '@storybook/addon-docs/blocks';
function _createMdxContent(props) {
const _components = {
h1: "h1",
Expand All @@ -489,7 +489,7 @@ describe('docs-mdx-compiler-plugin', () => {
expect(
clean(
compileSync(dedent`
import { Story } from '@storybook/addon-docs';
import { Story } from '@storybook/addon-docs/blocks';

# Story reference

Expand All @@ -499,7 +499,7 @@ describe('docs-mdx-compiler-plugin', () => {
).toMatchInlineSnapshot(`
import {Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs} from "react/jsx-runtime";
import {useMDXComponents as _provideComponents} from "@mdx-js/react";
import {Story} from '@storybook/addon-docs';
import {Story} from '@storybook/addon-docs/blocks';
function _createMdxContent(props) {
const _components = {
h1: "h1",
Expand All @@ -522,7 +522,7 @@ describe('docs-mdx-compiler-plugin', () => {
clean(
compileSync(
[
"import { Meta, Story } from '@storybook/addon-docs';",
"import { Meta, Story } from '@storybook/addon-docs/blocks';",
"import { titleFunction } from '../title-generators';",
'',

Expand All @@ -533,7 +533,7 @@ describe('docs-mdx-compiler-plugin', () => {
).toMatchInlineSnapshot(`
import {jsx as _jsx} from "react/jsx-runtime";
import {useMDXComponents as _provideComponents} from "@mdx-js/react";
import {Meta, Story} from '@storybook/addon-docs';
import {Meta, Story} from '@storybook/addon-docs/blocks';
import {titleFunction} from '../title-generators';
function _createMdxContent(props) {
return _jsx(Meta, {
Expand All @@ -548,7 +548,7 @@ describe('docs-mdx-compiler-plugin', () => {
expect(
clean(
compileSync(dedent`
import { Meta } from '@storybook/addon-docs';
import { Meta } from '@storybook/addon-docs/blocks';

<Meta />

Expand All @@ -560,7 +560,7 @@ describe('docs-mdx-compiler-plugin', () => {
).toMatchInlineSnapshot(`
import {Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs} from "react/jsx-runtime";
import {useMDXComponents as _provideComponents} from "@mdx-js/react";
import {Meta} from '@storybook/addon-docs';
import {Meta} from '@storybook/addon-docs/blocks';
function _createMdxContent(props) {
const _components = {
h1: "h1",
Expand All @@ -587,7 +587,7 @@ describe('docs-mdx-compiler-plugin', () => {
clean(
compileSync(dedent`
import { Button } from '@storybook/react/demo';
import { Story, Meta } from '@storybook/addon-docs';
import { Story, Meta } from '@storybook/addon-docs/blocks';

<Meta component={Button} />
`)
Expand All @@ -596,7 +596,7 @@ describe('docs-mdx-compiler-plugin', () => {
import {jsx as _jsx} from "react/jsx-runtime";
import {useMDXComponents as _provideComponents} from "@mdx-js/react";
import {Button} from '@storybook/react/demo';
import {Story, Meta} from '@storybook/addon-docs';
import {Story, Meta} from '@storybook/addon-docs/blocks';
function _createMdxContent(props) {
return _jsx(Meta, {
component: Button
Expand All @@ -610,7 +610,7 @@ describe('docs-mdx-compiler-plugin', () => {
expect(
clean(
compileSync(dedent`
import { Meta } from '@storybook/addon-docs';
import { Meta } from '@storybook/addon-docs/blocks';

<Meta title="Example/Introduction" />

Expand Down Expand Up @@ -638,7 +638,7 @@ describe('docs-mdx-compiler-plugin', () => {
).toMatchInlineSnapshot(`
import {Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs} from "react/jsx-runtime";
import {useMDXComponents as _provideComponents} from "@mdx-js/react";
import {Meta} from '@storybook/addon-docs';
import {Meta} from '@storybook/addon-docs/blocks';
function _createMdxContent(props) {
return _jsxs(_Fragment, {
children: [_jsx(Meta, {
Expand Down
3 changes: 0 additions & 3 deletions code/addons/docs/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ import { definePreviewAddon } from 'storybook/internal/csf';
import * as addonAnnotations from './preview';
import type { DocsTypes } from './types';

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore (these types only work once the package is compiled)
export * from '@storybook/addon-docs/blocks';
export { DocsRenderer } from './DocsRenderer';
export type { DocsTypes };

Expand Down
2 changes: 1 addition & 1 deletion code/addons/docs/template/stories/docs2/MetaOf.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta, Story, Stories } from '@storybook/addon-docs';
import { Meta, Story, Stories } from '@storybook/addon-docs/blocks';
import * as ButtonStories from './button.stories.ts';

<Meta of={ButtonStories} />
Expand Down
2 changes: 1 addition & 1 deletion code/addons/docs/template/stories/docs2/MetaOfNamed.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta, Story, Stories } from '@storybook/addon-docs';
import { Meta, Story, Stories } from '@storybook/addon-docs/blocks';
import * as ButtonStories from './button.stories.ts';

<Meta of={ButtonStories} name="Doc Name" />
Expand Down
2 changes: 1 addition & 1 deletion code/addons/docs/template/stories/docs2/Title.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta, Subtitle } from '@storybook/addon-docs';
import { Meta, Subtitle } from '@storybook/addon-docs/blocks';

<Meta title="Yabbadabbadooo" />

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta } from '@storybook/addon-docs';
import { Meta } from '@storybook/addon-docs/blocks';

<Meta title="UtfSymbolsScroll" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// once sandbox linking is working
//
// import { createElement } from 'react';
// import { Title, Primary } from '@storybook/addon-docs';
// import { Title, Primary } from '@storybook/addon-docs/blocks';
//
// const Override = () =>
// createElement('div', { style: { border: '10px solid green', padding: '100px' } }, [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta } from '@storybook/addon-docs';
import { Meta } from '@storybook/addon-docs/blocks';

<Meta isTemplate />

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta } from '@storybook/addon-docs';
import { Meta } from '@storybook/addon-docs/blocks';

<Meta title="docs2/Yabbadabbadooo" />

Expand Down
2 changes: 1 addition & 1 deletion code/frameworks/angular/template/stories/basics/README.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta } from '@storybook/addon-docs';
import { Meta } from '@storybook/addon-docs/blocks';

<Meta title="stories / frameworks / angular / basics / README" />

Expand Down
2 changes: 1 addition & 1 deletion code/frameworks/angular/template/stories/core/README.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta } from '@storybook/addon-docs';
import { Meta } from '@storybook/addon-docs/blocks';

<Meta title="stories / frameworks / angular / core / README" />

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta } from '@storybook/addon-docs';
import { Meta } from '@storybook/addon-docs/blocks';

<Meta title="stories / frameworks / angular / others / ngx-translate" />

Expand Down
2 changes: 1 addition & 1 deletion test-storybooks/external-docs/components/AccountForm.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta, Story } from '@storybook/addon-docs';
import { Meta, Story } from '@storybook/addon-docs/blocks';
import * as AccountFormStories from './AccountForm.stories';

## Docs for Account form
Expand Down
2 changes: 1 addition & 1 deletion test-storybooks/external-docs/components/Template.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Title, Description, ArgsTable, Stories, PRIMARY_STORY } from '@storybook/addon-docs';
import { Title, Description, ArgsTable, Stories, PRIMARY_STORY } from '@storybook/addon-docs/blocks';

# This is a template!

Expand Down
2 changes: 1 addition & 1 deletion test-storybooks/external-docs/components/emoji-button.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta } from '@storybook/addon-docs';
import { Meta } from '@storybook/addon-docs/blocks';
import * as EmojiButtonStories from './emoji-button.stories.tsx';
import Template from './Template.mdx';

Expand Down
2 changes: 1 addition & 1 deletion test-storybooks/external-docs/pages/_app.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable react/prop-types */
import React from 'react';
import 'nextra-theme-docs/style.css';
import { ExternalDocs } from '@storybook/addon-docs';
import { ExternalDocs } from '@storybook/addon-docs/blocks';

import * as reactAnnotations from '@storybook/react/preview';
import * as previewAnnotations from '../.storybook/preview';
Expand Down
2 changes: 1 addition & 1 deletion test-storybooks/external-docs/pages/index.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Callout from 'nextra-theme-docs/callout';
import { Title, Meta, Story, Canvas } from '@storybook/addon-docs';
import { Title, Meta, Story, Canvas } from '@storybook/addon-docs/blocks';
import * as AccountFormStories from '../components/AccountForm.stories';
import * as ButtonStories from '../components/button.stories';

Expand Down