Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release: Prerelease 8.0.0-alpha.7 #25407

Merged
merged 74 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
add44fc
dynamic import vite to force ESM mode
JReinhold Nov 28, 2023
78f1c35
improve readability of list of sandbox templates
JReinhold Nov 28, 2023
3fc9be5
add eslint rule to enforce dynamic vite imports
JReinhold Nov 28, 2023
52e2345
Merge branch 'next' into fix-vite5-cjs-warnings
JReinhold Nov 28, 2023
6b5d9c7
fix upgrade command
yannbf Dec 20, 2023
e3479a0
Viewport: Store viewport, rotation in globals
shilman Dec 26, 2023
22808ba
upgrade docs-mdx to use mdx3
yannbf Dec 21, 2023
b111368
upgrade mdx-js/react in addon-docs
yannbf Dec 22, 2023
ecea7dd
bring mdx-csf compiler into addon docs
yannbf Dec 28, 2023
9cdef8d
update docs-mdx canary
yannbf Dec 28, 2023
9a4a44a
fix mdx loader and cleanup
yannbf Dec 28, 2023
aa6a421
update mdx compiler tests
yannbf Dec 28, 2023
4209c50
fix mdx support on sandboxes
yannbf Dec 28, 2023
bd5ea14
ugprade docs-mdx
yannbf Dec 29, 2023
e627dbc
remove deprecation checks
yannbf Dec 29, 2023
1716cae
add migration notes
yannbf Dec 29, 2023
a80c3d5
ignore ts error
yannbf Dec 29, 2023
1be44eb
remove .stories.mdx stories and fix tests
yannbf Dec 29, 2023
a7bd3e5
upgrade docs-mdx
yannbf Dec 29, 2023
cfc86fc
remove unnecessary comment
yannbf Dec 29, 2023
3dcf056
rename .stories.mdx to .mdx
yannbf Dec 29, 2023
bfccfa5
Fix a small typo snapshot-testing.md
devanandb Dec 31, 2023
7243482
Merge pull request #25395 from devanandb/patch-1
jonniebigodes Dec 31, 2023
908bb30
Fix about page layout
cdedreuille Dec 31, 2023
7965437
Fix alignment in tabs header
cdedreuille Jan 1, 2024
26d83b3
Fix buttons in about footer
cdedreuille Jan 1, 2024
e383aeb
Merge branch 'next' into charles-fix-pages-layout
cdedreuille Jan 1, 2024
9e59c4b
Merge branch 'charles-fix-pages-layout' of https://github.com/storybo…
cdedreuille Jan 1, 2024
e723495
Update main.ts
cdedreuille Jan 1, 2024
b57c765
Update CHANGELOG.md for v7.6.7 [skip ci]
storybook-bot Jan 1, 2024
2071832
remove jsxOptions from addon-docs
yannbf Jan 2, 2024
ca6f060
refactor mdx-loader logic
yannbf Jan 2, 2024
7c4e18e
upgrade docs-mdx
yannbf Jan 2, 2024
281856e
Fix menu icon styles
cdedreuille Jan 2, 2024
d28917c
Merge branch 'next' into charles-fix-pages-layout
cdedreuille Jan 2, 2024
b892c7e
remove unused import
yannbf Jan 2, 2024
4bcf971
Merge pull request #25396 from storybookjs/charles-fix-pages-layout
cdedreuille Jan 2, 2024
2a4413b
CLI: Add Storyshots migration notice
yannbf Dec 27, 2023
f347c15
add test timeout
yannbf Dec 27, 2023
ea26963
add storyshots migration guide to migration notes
yannbf Jan 2, 2024
6db8c1b
add comment to deprecation notice
yannbf Jan 2, 2024
6bf2bce
Core: Remove unused warnOnLegacyHierarchySeparator type
yannbf Jan 2, 2024
fe7297a
Simplify viewports logic
shilman Jan 3, 2024
8b1cd0f
Merge branch 'next' into shilman/viewport-globals-third
shilman Jan 3, 2024
bd8236d
restructure migration deprecations, add svelte 4 section
JReinhold Jan 3, 2024
bf06e6e
Merge pull request #25424 from storybookjs/svelte-3-migration
JReinhold Jan 3, 2024
64eef7c
Remove vite plugins and drop Vite 3 support
kasperpeulen Jan 3, 2024
5f4cd57
Merge branch 'next' into kasper/remove-vite-plugins
kasperpeulen Jan 3, 2024
acc9f48
Add migration note
kasperpeulen Jan 3, 2024
abd99f2
Merge remote-tracking branch 'origin/kasper/remove-vite-plugins' into…
kasperpeulen Jan 3, 2024
e70b3d4
Add link to migration note
kasperpeulen Jan 3, 2024
fd63dc9
Merge remote-tracking branch 'origin/next' into fix-vite5-cjs-warnings
kasperpeulen Jan 3, 2024
3251604
Update MIGRATION.md
kasperpeulen Jan 3, 2024
2fd026c
Update MIGRATION.md
kasperpeulen Jan 3, 2024
a88b242
Remove unneeded mergeConfig
kasperpeulen Jan 3, 2024
d6d5c7a
remove --use-npm flag from CLI
yannbf Jan 2, 2024
852e5e3
Merge pull request #25414 from storybookjs/yann/remove-use-npm-flag
yannbf Jan 3, 2024
bf9e01b
Merge pull request #25427 from storybookjs/kasper/remove-vite-plugins
kasperpeulen Jan 3, 2024
0aa50e9
Merge pull request #25005 from storybookjs/fix-vite5-cjs-warnings
kasperpeulen Jan 3, 2024
85af265
Update MIGRATION.md
yannbf Jan 3, 2024
2c6afe2
Update MIGRATION.md
yannbf Jan 3, 2024
d43f6c5
Viewport: Fix keyboard shortcut
shilman Jan 3, 2024
ff54894
Merge pull request #25423 from storybookjs/shilman/viewport-globals-t…
shilman Jan 3, 2024
3b9e381
Merge branch 'next' into fix/upgrade-command
yannbf Jan 3, 2024
a54da8f
Merge pull request #25411 from storybookjs/yann/deprecation-comment
yannbf Jan 3, 2024
52a7e36
Merge branch 'next' into yann/storyshots-migration-warn
yannbf Jan 3, 2024
70f85f6
add migration notes about the removal of the shim packages
ndelangen Jan 3, 2024
97ae404
remove legacy mdx 1 feature documentation
yannbf Jan 3, 2024
b43f7f4
Merge pull request #25416 from storybookjs/yann/remove-unused-hierarc…
yannbf Jan 3, 2024
ad1d921
Merge pull request #25327 from storybookjs/yann/storyshots-migration-…
yannbf Jan 3, 2024
b82657f
Merge pull request #25303 from storybookjs/yann/upgrade-mdx
yannbf Jan 3, 2024
570636b
Merge pull request #25284 from storybookjs/fix/upgrade-command
yannbf Jan 3, 2024
f43be13
Merge pull request #25438 from storybookjs/norbert/migration-note-abo…
yannbf Jan 3, 2024
303eb63
Write changelog for 8.0.0-alpha.7 [skip ci]
storybook-bot Jan 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 7.6.7

- Core: Skip no-framework error when ignorePreview=true - [#25286](https://github.com/storybookjs/storybook/pull/25286), thanks [@ndelangen](https://github.com/ndelangen)!
- Dependencies: Semver dependency fixes - [#25283](https://github.com/storybookjs/storybook/pull/25283), thanks [@ndelangen](https://github.com/ndelangen)!
- Vite: Fix pre-transform error in Vite 5 - [#25329](https://github.com/storybookjs/storybook/pull/25329), thanks [@yannbf](https://github.com/yannbf)!
- Vue3: Fix pnp by making compiler-core a dependency - [#25311](https://github.com/storybookjs/storybook/pull/25311), thanks [@shilman](https://github.com/shilman)!

## 7.6.6

- SvelteKit: Support 2.0 modules with mocks - [#25244](https://github.com/storybookjs/storybook/pull/25244), thanks [@paoloricciuti](https://github.com/paoloricciuti)!
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.prerelease.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
## 8.0.0-alpha.7

- Addon-Docs: Upgrade to MDX3 - [#25303](https://github.com/storybookjs/storybook/pull/25303), thanks [@yannbf](https://github.com/yannbf)!
- CLI: Add Storyshots migration notice - [#25327](https://github.com/storybookjs/storybook/pull/25327), thanks [@yannbf](https://github.com/yannbf)!
- CLI: Fix regex used in upgrade command - [#25284](https://github.com/storybookjs/storybook/pull/25284), thanks [@yannbf](https://github.com/yannbf)!
- CLI: Remove --use-npm flag - [#25414](https://github.com/storybookjs/storybook/pull/25414), thanks [@yannbf](https://github.com/yannbf)!
- Core: Remove unused warnOnLegacyHierarchySeparator type - [#25416](https://github.com/storybookjs/storybook/pull/25416), thanks [@yannbf](https://github.com/yannbf)!
- Core: Remove vite plugins and drop Vite 3 support - [#25427](https://github.com/storybookjs/storybook/pull/25427), thanks [@kasperpeulen](https://github.com/kasperpeulen)!
- Maintenance: Add comment to deprecation notice in Button component - [#25411](https://github.com/storybookjs/storybook/pull/25411), thanks [@yannbf](https://github.com/yannbf)!
- UI: Fix about page layout - [#25396](https://github.com/storybookjs/storybook/pull/25396), thanks [@cdedreuille](https://github.com/cdedreuille)!
- Viewport: Store viewport, rotation in globals - [#25423](https://github.com/storybookjs/storybook/pull/25423), thanks [@shilman](https://github.com/shilman)!
- Vite: Fix Vite 5 CJS warnings - [#25005](https://github.com/storybookjs/storybook/pull/25005), thanks [@JReinhold](https://github.com/JReinhold)!

## 8.0.0-alpha.6

- NextJS: Autoconfigure public directory for new projects - [#25279](https://github.com/storybookjs/storybook/pull/25279), thanks [@shilman](https://github.com/shilman)!
Expand Down
129 changes: 106 additions & 23 deletions MIGRATION.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
<h1>Migration</h1>

- [From version 7.x to 8.0.0](#from-version-7x-to-800)
- [Removed deprecated shim packages](#removed-deprecated-shim-packages)
- [Framework-specific Vite plugins have to be explicitly added](#framework-specific-vite-plugins-have-to-be-explicitly-added)
- [Implicit actions can not be used during rendering (for example in the play function)](#implicit-actions-can-not-be-used-during-rendering-for-example-in-the-play-function)
- [MDX related changes](#mdx-related-changes)
- [MDX is upgraded to v3](#mdx-is-upgraded-to-v3)
- [Dropping support for \*.stories.mdx (CSF in MDX) format and MDX1 support](#dropping-support-for-storiesmdx-csf-in-mdx-format-and-mdx1-support)
- [Dropping support for id, name and story in Story block](#dropping-support-for-id-name-and-story-in-story-block)
- [Core changes](#core-changes)
- [Dropping support for Node.js 16](#dropping-support-for-nodejs-16)
- [Autotitle breaking fixes](#autotitle-breaking-fixes)
Expand All @@ -10,12 +16,19 @@
- [UI layout state has changed shape](#ui-layout-state-has-changed-shape)
- [New UI and props for Button and IconButton components](#new-ui-and-props-for-button-and-iconbutton-components)
- [Icons is deprecated](#icons-is-deprecated)
- [React-docgen component analysis by default](#react-docgen-component-analysis-by-default)
- [Removed postinstall](#removed-postinstall)
- [Removed stories.json](#removed-storiesjson)
- [Framework-specific changes](#framework-specific-changes)
- [Angular: Drop support for Angular \< 15](#angular-drop-support-for-angular--15)
- [Next.js: Drop support for version \< 13.5](#nextjs-drop-support-for-version--135)
- [React](#react)
- [`react-docgen` component analysis by default](#react-docgen-component-analysis-by-default)
- [Next.js](#nextjs)
- [Require Next.js 13.5 and up](#require-nextjs-135-and-up)
- [Angular](#angular)
- [Require Angular 15 and up](#require-angular-15-and-up)
- [Svelte](#svelte)
- [Require Svelte 4 and up](#require-svelte-4-and-up)
- [Deprecations which are now removed](#deprecations-which-are-now-removed)
- [--use-npm flag in storybook CLI](#--use-npm-flag-in-storybook-cli)
- [From version 7.5.0 to 7.6.0](#from-version-750-to-760)
- [CommonJS with Vite is deprecated](#commonjs-with-vite-is-deprecated)
- [Using implicit actions during rendering is deprecated](#using-implicit-actions-during-rendering-is-deprecated)
Expand Down Expand Up @@ -331,6 +344,36 @@

## From version 7.x to 8.0.0

### Removed deprecated shim packages

In Storybook 7, these packages existed for backwards compatibility, but were marked as deprecated:

- `@storybook/addons` - this package has been split into 2 packages: `@storybook/preview-api` and `@storybook/manager-api`, see more here: [New Addons API](#new-addons-api).
- `@storybook/channel-postmessage` - this package has been merged into `@storybook/channel`.
- `@storybook/channel-websocket` - this package has been merged into `@storybook/channel`.
- `@storybook/client-api` - this package has been merged into `@storybook/preview-api`.
- `@storybook/core-client` - this package has been merged into `@storybook/preview-api`.
- `@storybook/preview-web` - this package has been merged into `@storybook/preview-api`.
- `@storybook/store` - this package has been merged into `@storybook/preview-api`.
- `@storybook/api` - this package has been replaced with `@storybook/manager-api`.

This section explains the rationale, and the required changed you might have to make: [New Addons API](#new-addons-api)

### Framework-specific Vite plugins have to be explicitly added

In Storybook 7, we would automatically add frameworks-specific Vite plugins, e.g. `@vitejs/plugin-react` if not installed.
In Storybook 8 those plugins have to be added explicitly in the user's `vite.config.ts`:

```ts
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
});
```

### Implicit actions can not be used during rendering (for example in the play function)

In Storybook 7, we inferred if the component accepts any action props,
Expand Down Expand Up @@ -380,6 +423,26 @@ To summarize:
- This allows users and (test) integrators to run or build storybook without docgen, boosting the user performance and allows tools to give quicker feedback.
- This will make sure that we can one day lazy load docgen, without changing how stories are rendered.

### MDX related changes

#### MDX is upgraded to v3

Storybook now uses MDX3 under the hood. This change contains many improvements and a few small breaking changes that probably won't affect you. However we recommend checking the [migration notes from MDX here](https://mdxjs.com/blog/v3/).

#### Dropping support for *.stories.mdx (CSF in MDX) format and MDX1 support

In Storybook 7, we deprecated the ability of using MDX both for documentation and for defining stories in the same .stories.mdx file. It is now removed, and Storybook won't support .stories.mdx files anymore. We provide migration scripts to help you onto the new format.

If you were using the [legacy MDX1 format](#legacy-mdx1-support), you will have to remove the `legacyMdx1` main.js feature flag and the `@storybook/mdx1-csf` package.

Alongside with this change, the `jsxOptions` configuration was removed as it is not used anymore.

[More info here](https://storybook.js.org/docs/migration-guide#storiesmdx-to-mdxcsf).

#### Dropping support for id, name and story in Story block

Referencing stories by `id`, `name` or `story` in the Story block is not possible anymore. [More info here](#story-block).

### Core changes

#### Dropping support for Node.js 16
Expand Down Expand Up @@ -407,22 +470,24 @@ Addon authors are advised to upgrade to react v18.

#### Storyshots has been removed

Storyshots was an addon for storybook which allowed users to turn their stories into automated snapshot-tests.
Storyshots was an addon for Storybook which allowed users to turn their stories into automated snapshot tests.

Every story would automatically be taken into account and create a snapshot file.

Every story would automatically be taken into account and created a snapshot-file for.
Snapshot testing has since fallen out of favor and is no longer recommended.

Snapshot-testing has since fallen out of favor and is no longer recommended.
In addition to its limited use, and high chance of false positives, Storyshots ran code developed to run in the browser in NodeJS via JSDOM.
JSDOM has limitations and is not a perfect emulation of the browser environment; therefore, Storyshots was always a pain to set up and maintain.

In addition to it's limited use, and high chance of false-positives, storyshots ran code developed to run in the browser in NodeJS via JSDOM.
JSDOM has limitations and is not a perfect emulation of the browser environment; therefore storyshots was always a pain to setup and maintain.
The Storybook team has built the test-runner as a direct replacement, which utilizes Playwright to connect to an actual browser where Storybook runs the code.

The storybook team has build the test-runner as a direct replacement, which utilizes playwright to connect to an actual browser where storybook runs the code.
In addition, CSF has expanded to allow for play functions to be defined on stories, which allows for more complex testing scenarios, fully integrated within Storybook itself (and supported by the test-runner, and not Storyshots).

In addition CSF has expanded to allow for play-function to be defined on stories, which allows for more complex testing scenarios, fully integrated within storybook itself (and supported by the test-runner, and not storyshots).
Finally, storyStoreV7: true (the default and only option in Storybook 8), was not supported by Storyshots.

Finally `storyStoreV7: true` (the default and only options in storybook 8), was not supported by storyshots.
By removing Storyshots, the Storybook team was unblocked from moving (eventually) to an ESM-only Storybook, which is a big step towards a more modern Storybook.

By removing storyshots, the storybook team was unblocked from moving (eventually) to an ESM-only storybook, which is a big step towards a more modern storybook.
Please check the [migration guide](https://storybook.js.org/docs/writing-tests/storyshots-migration-guide) that we prepared.

#### UI layout state has changed shape

Expand Down Expand Up @@ -454,7 +519,21 @@ The `IconButton` doesn't have any deprecated props but it now uses the new `Butt

In Storybook 8.0 we are introducing a new icon library available with `@storybook/icons`. We are deprecating the `Icons` component in `@storybook/components` and recommend that addon creators and Storybook maintainers use the new `@storybook/icons` component instead.

#### React-docgen component analysis by default
#### Removed postinstall

We removed the `@storybook/postinstall` package, which provided some utilities for addons to programmatically modify user configuration files on install. This package was years out of date, so this should be a non-disruptive change. If your addon used the package, you can view the old source code [here](https://github.com/storybookjs/storybook/tree/release-7-5/code/lib/postinstall) and adapt it into your addon.

#### Removed stories.json

In addition to the built storybook, `storybook build` generates two files, `index.json` and `stories.json`, that list out the contents of the Storybook. `stories.json` is a legacy format and we included it for backwards compatibility. As of 8.0 we no longer build `stories.json` by default, and we will remove it completely in 9.0.

In the meantime if you have code that relies on `stories.json`, you can find code that transforms the "v4" `index.json` to the "v3" `stories.json` format (and their respective TS types): https://github.com/storybookjs/storybook/blob/release-7-5/code/lib/core-server/src/utils/stories-json.ts#L71-L91

### Framework-specific changes

#### React

##### `react-docgen` component analysis by default

In Storybook 7, we used `react-docgen-typescript` to analyze React component props and auto-generate controls. In Storybook 8, we have moved to `react-docgen` as the new default. `react-docgen` is dramatically more efficient, shaving seconds off of dev startup times. However, it only analyzes basic TypeScript constructs.

Expand All @@ -470,25 +549,29 @@ export default {

For more information see: https://storybook.js.org/docs/react/api/main-config-typescript#reactdocgen

#### Removed postinstall
#### Next.js

We removed the `@storybook/postinstall` package, which provided some utilities for addons to programmatically modify user configuration files on install. This package was years out of date, so this should be a non-disruptive change. If your addon used the package, you can view the old source code [here](https://github.com/storybookjs/storybook/tree/release-7-5/code/lib/postinstall) and adapt it into your addon.
##### Require Next.js 13.5 and up

#### Removed stories.json
Starting in 8.0, Storybook requires Next.js 13.5 and up.

In addition to the built storybook, `storybook build` generates two files, `index.json` and `stories.json`, that list out the contents of the Storybook. `stories.json` is a legacy format and we included it for backwards compatibility. As of 8.0 we no longer build `stories.json` by default, and we will remove it completely in 9.0.
#### Angular

In the meantime if you have code that relies on `stories.json`, you can find code that transforms the "v4" `index.json` to the "v3" `stories.json` format (and their respective TS types): https://github.com/storybookjs/storybook/blob/release-7-5/code/lib/core-server/src/utils/stories-json.ts#L71-L91
##### Require Angular 15 and up

### Framework-specific changes
Starting in 8.0, Storybook requires Angular 15 and up.

#### Svelte

##### Require Svelte 4 and up

#### Angular: Drop support for Angular \< 15
Starting in 8.0, Storybook requires Svelte 4 and up.

Starting in 8.0, we drop support for Angular < 15
### Deprecations which are now removed

#### Next.js: Drop support for version \< 13.5
#### --use-npm flag in storybook CLI

Starting in 8.0, we drop support for Next.js < 13.5.
The `--use-npm` is now removed. Use `--package-manager=npm` instead. [More info here](#cli-option---use-npm-deprecated).

## From version 7.5.0 to 7.6.0

Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ For additional help, share your issue in [the repo's GitHub Discussions](https:/

See [Addon / Framework Support Table](https://storybook.js.org/docs/react/api/frameworks-feature-support)

### Deprecated Addons
### Deprecated/Removed Addons

| Addons | |
| -------------------------------------------------------------------------------------------- | ---------------------------------------------------------- |
Expand All @@ -147,12 +147,14 @@ See [Addon / Framework Support Table](https://storybook.js.org/docs/react/api/fr
| [options](https://www.npmjs.com/package/@storybook/addon-options) | Customize the Storybook UI in code |
| [storyshots](https://github.com/storybookjs/storybook/tree/main/code/addons/storyshots-core) | Snapshot testing for components in Storybook |

To continue improving your experience, we have to eventually deprecate certain addons in favor of new and better tools.
To continue improving your experience, we have to eventually deprecate or remove certain addons in favor of new and better tools.

If you're using info/notes, we highly recommend you migrate to [docs](code/addons/docs/) instead, and [here is a guide](code/addons/docs/docs/recipes.md#migrating-from-notesinfo-addons) to help you.

If you're using contexts, we highly recommend you migrate to [toolbars](https://github.com/storybookjs/storybook/tree/next/code/addons/toolbars) and [here is a guide](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#deprecated-addon-contexts) to help you.

If you're using addon-storyshots, we highly recommend you migrate to the Storybook [test-runner](https://github.com/storybookjs/test-runner) and [here is a guide](https://storybook.js.org/docs/writing-tests/storyshots-migration-guide) to help you.

## Badges & Presentation materials

We have a badge! Link it to your live Storybook example.
Expand Down
12 changes: 12 additions & 0 deletions code/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,18 @@ module.exports = {
allowIndexSignaturePropertyAccess: true,
},
],
'@typescript-eslint/no-restricted-imports': [
'error',
{
paths: [
{
name: 'vite',
message: 'Please dynamically import from vite instead, to force the use of ESM',
allowTypeImports: true,
},
],
},
],
},
overrides: [
{
Expand Down
36 changes: 1 addition & 35 deletions code/addons/controls/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,38 +176,4 @@ Like [story parameters](https://storybook.js.org/docs/react/writing-stories/para

### How do controls work with MDX?

MDX compiles to component story format (CSF) under the hood, so there's a direct mapping for every example above using the `args` and `argTypes` props.

Consider this example in CSF:

```js
import { Button } from './Button';
export default {
title: 'Button',
component: Button,
argTypes: {
background: { control: 'color' },
},
};

const Template = (args) => <Button {...args} />;
export const Basic = Template.bind({});
Basic.args = { label: 'hello', background: '#ff0' };
```

Here's the MDX equivalent:

```jsx
import { Meta, Story } from '@storybook/addon-docs';
import { Button } from './Button';

<Meta title="Button" component={Button} argTypes={{ background: { control: 'color' } }} />

export const Template = (args) => <Button {...args} />

<Story name="Basic" args={{ label: 'hello', background: '#ff0' }}>
{Template.bind({})}
</Story>
```

For more info, see a full [Controls example in MDX for Vue](https://raw.githubusercontent.com/storybookjs/storybook/next/code/examples/vue-kitchen-sink/src/stories/addon-controls.stories.mdx).
When importing stories from your CSF file into MDX, controls will work the same way. See [the documentation](https://storybook.js.org/docs/writing-docs/mdx#basic-example) for examples.
Loading