diff --git a/examples/vue/.env b/examples/vue2/.env
similarity index 100%
rename from examples/vue/.env
rename to examples/vue2/.env
diff --git a/examples/vue2/.storybook/main.ts b/examples/vue2/.storybook/main.ts
new file mode 100644
index 00000000..8bb0a5f4
--- /dev/null
+++ b/examples/vue2/.storybook/main.ts
@@ -0,0 +1,22 @@
+const { resolve } = require('path');
+const { mergeConfig } = require('vite');
+
+export default {
+ framework: '@storybook/vue',
+ stories: ['../stories/**/*.stories.mdx', '../stories/**/*.stories.@(js|jsx|ts|tsx)'],
+ addons: ['@storybook/addon-links', '@storybook/addon-essentials'],
+ core: {
+ builder: '@storybook/builder-vite',
+ // we don't want to muck up the data when we're working on the builder
+ disableTelemetry: true,
+ },
+ features: {
+ previewMdx2: true,
+ },
+ async viteFinal(config, { configType }) {
+ // Demonstrates use of mergeConfig and resolve.alias as an array
+ return mergeConfig(config, {
+ resolve: { alias: [{ find: '@assets', replacement: resolve(__dirname, '..', 'stories', 'assets') }] },
+ });
+ },
+};
diff --git a/examples/vue/.storybook/preview.js b/examples/vue2/.storybook/preview.js
similarity index 100%
rename from examples/vue/.storybook/preview.js
rename to examples/vue2/.storybook/preview.js
diff --git a/examples/vue2/README.md b/examples/vue2/README.md
new file mode 100644
index 00000000..aad37990
--- /dev/null
+++ b/examples/vue2/README.md
@@ -0,0 +1,5 @@
+# Vue
+
+This example demonstrates storybook in a Vue 2 project.
+
+This example also demonstrates MDX2 support.
diff --git a/examples/vue2/package.json b/examples/vue2/package.json
new file mode 100644
index 00000000..f49a5562
--- /dev/null
+++ b/examples/vue2/package.json
@@ -0,0 +1,34 @@
+{
+ "name": "example-vue2",
+ "private": true,
+ "version": "0.0.0",
+ "description": "",
+ "main": "index.js",
+ "scripts": {
+ "storybook": "start-storybook --port 6010",
+ "build-storybook": "build-storybook",
+ "preview-storybook": "http-server storybook-static --port 6010 --silent",
+ "test": "wait-on tcp:6010 && test-storybook --url 'http://localhost:6010'",
+ "test-ci": "run-p --race test preview-storybook"
+ },
+ "author": "",
+ "license": "MIT",
+ "dependencies": {
+ "vue": "^2.7"
+ },
+ "devDependencies": {
+ "@storybook/addon-a11y": "^6.5.9",
+ "@storybook/addon-essentials": "^6.5.9",
+ "@storybook/builder-vite": "workspace:*",
+ "@storybook/mdx2-csf": "^0.0.3",
+ "@storybook/test-runner": "0.1.0",
+ "@storybook/vue": "^6.5.9",
+ "@vitejs/plugin-vue2": "^1.1.2",
+ "http-server": "^14.1.0",
+ "jest": "^27.5.1",
+ "npm-run-all": "^4.1.5",
+ "vite": "^3.0.0-beta.9",
+ "vue-loader": "^15.9.8",
+ "wait-on": "^6.0.1"
+ }
+}
diff --git a/examples/vue/stories/Button.stories.js b/examples/vue2/stories/Button.stories.js
similarity index 100%
rename from examples/vue/stories/Button.stories.js
rename to examples/vue2/stories/Button.stories.js
diff --git a/examples/vue/stories/Button.vue b/examples/vue2/stories/Button.vue
similarity index 100%
rename from examples/vue/stories/Button.vue
rename to examples/vue2/stories/Button.vue
diff --git a/examples/vue/stories/EnvironmentVariables.stories.js b/examples/vue2/stories/EnvironmentVariables.stories.js
similarity index 100%
rename from examples/vue/stories/EnvironmentVariables.stories.js
rename to examples/vue2/stories/EnvironmentVariables.stories.js
diff --git a/examples/vue/stories/EnvironmentVariables.vue b/examples/vue2/stories/EnvironmentVariables.vue
similarity index 100%
rename from examples/vue/stories/EnvironmentVariables.vue
rename to examples/vue2/stories/EnvironmentVariables.vue
diff --git a/examples/vue/stories/Header.stories.js b/examples/vue2/stories/Header.stories.js
similarity index 100%
rename from examples/vue/stories/Header.stories.js
rename to examples/vue2/stories/Header.stories.js
diff --git a/examples/vue/stories/Header.vue b/examples/vue2/stories/Header.vue
similarity index 100%
rename from examples/vue/stories/Header.vue
rename to examples/vue2/stories/Header.vue
diff --git a/examples/vue/stories/Introduction.stories.mdx b/examples/vue2/stories/Introduction.stories.mdx
similarity index 100%
rename from examples/vue/stories/Introduction.stories.mdx
rename to examples/vue2/stories/Introduction.stories.mdx
diff --git a/examples/vue/stories/Page.stories.js b/examples/vue2/stories/Page.stories.js
similarity index 100%
rename from examples/vue/stories/Page.stories.js
rename to examples/vue2/stories/Page.stories.js
diff --git a/examples/vue/stories/Page.vue b/examples/vue2/stories/Page.vue
similarity index 100%
rename from examples/vue/stories/Page.vue
rename to examples/vue2/stories/Page.vue
diff --git a/examples/vue/stories/assets/code-brackets.svg b/examples/vue2/stories/assets/code-brackets.svg
similarity index 100%
rename from examples/vue/stories/assets/code-brackets.svg
rename to examples/vue2/stories/assets/code-brackets.svg
diff --git a/examples/vue/stories/assets/colors.svg b/examples/vue2/stories/assets/colors.svg
similarity index 100%
rename from examples/vue/stories/assets/colors.svg
rename to examples/vue2/stories/assets/colors.svg
diff --git a/examples/vue/stories/assets/comments.svg b/examples/vue2/stories/assets/comments.svg
similarity index 100%
rename from examples/vue/stories/assets/comments.svg
rename to examples/vue2/stories/assets/comments.svg
diff --git a/examples/vue/stories/assets/direction.svg b/examples/vue2/stories/assets/direction.svg
similarity index 100%
rename from examples/vue/stories/assets/direction.svg
rename to examples/vue2/stories/assets/direction.svg
diff --git a/examples/vue/stories/assets/flow.svg b/examples/vue2/stories/assets/flow.svg
similarity index 100%
rename from examples/vue/stories/assets/flow.svg
rename to examples/vue2/stories/assets/flow.svg
diff --git a/examples/vue/stories/assets/plugin.svg b/examples/vue2/stories/assets/plugin.svg
similarity index 100%
rename from examples/vue/stories/assets/plugin.svg
rename to examples/vue2/stories/assets/plugin.svg
diff --git a/examples/vue/stories/assets/repo.svg b/examples/vue2/stories/assets/repo.svg
similarity index 100%
rename from examples/vue/stories/assets/repo.svg
rename to examples/vue2/stories/assets/repo.svg
diff --git a/examples/vue/stories/assets/stackalt.svg b/examples/vue2/stories/assets/stackalt.svg
similarity index 100%
rename from examples/vue/stories/assets/stackalt.svg
rename to examples/vue2/stories/assets/stackalt.svg
diff --git a/examples/vue/stories/button.css b/examples/vue2/stories/button.css
similarity index 100%
rename from examples/vue/stories/button.css
rename to examples/vue2/stories/button.css
diff --git a/examples/vue/stories/header.css b/examples/vue2/stories/header.css
similarity index 100%
rename from examples/vue/stories/header.css
rename to examples/vue2/stories/header.css
diff --git a/examples/vue/stories/page.css b/examples/vue2/stories/page.css
similarity index 100%
rename from examples/vue/stories/page.css
rename to examples/vue2/stories/page.css
diff --git a/examples/vue3/.env b/examples/vue3/.env
new file mode 100644
index 00000000..e613627a
--- /dev/null
+++ b/examples/vue3/.env
@@ -0,0 +1,3 @@
+STORYBOOK_ENV_VAR=included
+VITE_ENV_VAR=included
+ENV_VAR=should_not_be_included
diff --git a/examples/vue/.storybook/main.ts b/examples/vue3/.storybook/main.ts
similarity index 100%
rename from examples/vue/.storybook/main.ts
rename to examples/vue3/.storybook/main.ts
diff --git a/examples/vue3/.storybook/preview.js b/examples/vue3/.storybook/preview.js
new file mode 100644
index 00000000..7ae55b1a
--- /dev/null
+++ b/examples/vue3/.storybook/preview.js
@@ -0,0 +1,10 @@
+export const parameters = {
+ actions: { argTypesRegex: '^on[A-Z].*' },
+ controls: {
+ expanded: true,
+ matchers: {
+ color: /(background|color)$/i,
+ date: /Date$/,
+ },
+ },
+};
diff --git a/examples/vue/README.md b/examples/vue3/README.md
similarity index 100%
rename from examples/vue/README.md
rename to examples/vue3/README.md
diff --git a/examples/vue/package.json b/examples/vue3/package.json
similarity index 97%
rename from examples/vue/package.json
rename to examples/vue3/package.json
index f588cdc7..2df1d965 100644
--- a/examples/vue/package.json
+++ b/examples/vue3/package.json
@@ -1,5 +1,5 @@
{
- "name": "example-vue",
+ "name": "example-vue3",
"private": true,
"version": "0.0.0",
"description": "",
diff --git a/examples/vue3/stories/Button.stories.js b/examples/vue3/stories/Button.stories.js
new file mode 100644
index 00000000..d48c6cf9
--- /dev/null
+++ b/examples/vue3/stories/Button.stories.js
@@ -0,0 +1,47 @@
+import MyButton from './Button.vue';
+
+export default {
+ title: 'Example/Button',
+ component: MyButton,
+ argTypes: {
+ backgroundColor: { control: 'color' },
+ size: {
+ control: { type: 'select', options: ['small', 'medium', 'large'] },
+ },
+ onClick: {},
+ },
+};
+
+const Template = (args) => ({
+ // Components used in your story `template` are defined in the `components` object
+ components: { MyButton },
+ // The story's `args` need to be mapped into the template through the `setup()` method
+ setup() {
+ return { args };
+ },
+ // And then the `args` are bound to your component with `v-bind="args"`
+ template: '',
+});
+
+export const Primary = Template.bind({});
+Primary.args = {
+ primary: true,
+ label: 'Button',
+};
+
+export const Secondary = Template.bind({});
+Secondary.args = {
+ label: 'Button',
+};
+
+export const Large = Template.bind({});
+Large.args = {
+ size: 'large',
+ label: 'Button',
+};
+
+export const Small = Template.bind({});
+Small.args = {
+ size: 'small',
+ label: 'Button',
+};
diff --git a/examples/vue3/stories/Button.vue b/examples/vue3/stories/Button.vue
new file mode 100644
index 00000000..c2cbada1
--- /dev/null
+++ b/examples/vue3/stories/Button.vue
@@ -0,0 +1,69 @@
+
+
+
+
+
diff --git a/examples/vue3/stories/EnvironmentVariables.stories.js b/examples/vue3/stories/EnvironmentVariables.stories.js
new file mode 100644
index 00000000..22ce8279
--- /dev/null
+++ b/examples/vue3/stories/EnvironmentVariables.stories.js
@@ -0,0 +1,22 @@
+import EnvVars from './EnvironmentVariables.vue';
+
+export default {
+ title: 'Environment Variables',
+ component: EnvVars,
+};
+
+const Template = (args) => ({
+ // Components used in your story `template` are defined in the `components` object
+ components: { EnvVars },
+ // The story's `args` need to be mapped into the template through the `setup()` method
+ setup() {
+ return { args };
+ },
+ // And then the `args` are bound to your component with `v-bind="args"`
+ template: '',
+});
+
+export const Info = Template.bind({});
+Info.args = {
+ dynamic: import.meta.env.VITE_ENV_VAR,
+};
diff --git a/examples/vue3/stories/EnvironmentVariables.vue b/examples/vue3/stories/EnvironmentVariables.vue
new file mode 100644
index 00000000..2e60a6a2
--- /dev/null
+++ b/examples/vue3/stories/EnvironmentVariables.vue
@@ -0,0 +1,30 @@
+
+
+
import.meta.env:
+
{{ env }}
+
import.meta.env.STORYBOOK:
+
{{ storybook }}
+
dynamic:
+
{{ dynamic }}
+
+
+
+
diff --git a/examples/vue3/stories/Header.stories.js b/examples/vue3/stories/Header.stories.js
new file mode 100644
index 00000000..eb782651
--- /dev/null
+++ b/examples/vue3/stories/Header.stories.js
@@ -0,0 +1,28 @@
+import MyHeader from './Header.vue';
+
+export default {
+ title: 'Example/Header',
+ component: MyHeader,
+};
+
+const Template = (args) => ({
+ // Components used in your story `template` are defined in the `components` object
+ components: { MyHeader },
+ // The story's `args` need to be mapped into the template through the `setup()` method
+ setup() {
+ // Story args can be spread into the returned object
+ return { ...args };
+ },
+ // Then, the spread values can be accessed directly in the template
+ template: '',
+});
+
+export const LoggedIn = Template.bind({});
+LoggedIn.args = {
+ user: {},
+};
+
+export const LoggedOut = Template.bind({});
+LoggedOut.args = {
+ user: null,
+};
diff --git a/examples/vue3/stories/Header.vue b/examples/vue3/stories/Header.vue
new file mode 100644
index 00000000..006bcc4b
--- /dev/null
+++ b/examples/vue3/stories/Header.vue
@@ -0,0 +1,40 @@
+
+
+
+
+
+
Acme
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/vue3/stories/Introduction.stories.mdx b/examples/vue3/stories/Introduction.stories.mdx
new file mode 100644
index 00000000..a09097e2
--- /dev/null
+++ b/examples/vue3/stories/Introduction.stories.mdx
@@ -0,0 +1,200 @@
+import { Meta } from '@storybook/addon-docs';
+import Code from '@assets/code-brackets.svg';
+import Colors from '@assets/colors.svg';
+import Comments from '@assets/comments.svg';
+import Direction from '@assets/direction.svg';
+import Flow from '@assets/flow.svg';
+import Plugin from '@assets/plugin.svg';
+import Repo from '@assets/repo.svg';
+import StackAlt from '@assets/stackalt.svg';
+
+
+
+
+
+# Welcome to Storybook
+
+Storybook helps you build UI components in isolation from your app's business logic, data, and context.
+That makes it easy to develop hard-to-reach states. Save these UI states as **stories** to revisit during development, testing, or QA.
+
+Browse example stories now by navigating to them in the sidebar.
+View their code in the `src/stories` directory to learn how they work.
+We recommend building UIs with a [**component-driven**](https://componentdriven.org) process starting with atomic components and ending with pages.
+
+
+ TipEdit the Markdown in src/stories/Introduction.stories.mdx
+
diff --git a/examples/vue3/stories/Page.stories.js b/examples/vue3/stories/Page.stories.js
new file mode 100644
index 00000000..f4acfa2d
--- /dev/null
+++ b/examples/vue3/stories/Page.stories.js
@@ -0,0 +1,29 @@
+import MyPage from './Page.vue';
+import * as HeaderStories from './Header.stories';
+
+export default {
+ title: 'Example/Page',
+ component: MyPage,
+};
+
+const Template = (args) => ({
+ // Components used in your story `template` are defined in the `components` object
+ components: { MyPage },
+ // The story's `args` need to be mapped into the template through the `setup()` method
+ setup() {
+ // Story args can be mapped to keys in the returned object
+ return { user: args.user };
+ },
+ // Then, those values can be accessed directly in the template
+ template: '',
+});
+
+export const LoggedIn = Template.bind({});
+LoggedIn.args = {
+ ...HeaderStories.LoggedIn.args,
+};
+
+export const LoggedOut = Template.bind({});
+LoggedOut.args = {
+ ...HeaderStories.LoggedOut.args,
+};
diff --git a/examples/vue3/stories/Page.vue b/examples/vue3/stories/Page.vue
new file mode 100644
index 00000000..4ecd8ed7
--- /dev/null
+++ b/examples/vue3/stories/Page.vue
@@ -0,0 +1,69 @@
+
+
+
+
+
+
Pages in Storybook
+
+ We recommend building UIs with a
+
+ component-driven
+
+ process starting with atomic components and ending with pages.
+
+
+ Render pages with mock data. This makes it easy to build and review page states without needing to navigate to
+ them in your app. Here are some handy patterns for managing page data in Storybook:
+
+
+
+ Use a higher-level connected component. Storybook helps you compose such data from the "args" of child
+ component stories
+
+
+ Assemble data in the page component from your services. You can mock these services out using Storybook.
+
+
+
+ Get a guided tutorial on component-driven development at
+ Storybook tutorials
+ . Read more in the
+ docs
+ .
+
+
+ Tip
+ Adjust the width of the canvas with the
+
+ Viewports addon in the toolbar
+