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

Docs: Add docs for vue3-vite framework #26221

Merged
merged 9 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
45 changes: 2 additions & 43 deletions code/frameworks/vue3-vite/README.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,3 @@
# Storybook for Vue 3 and Vite
# Storybook for Vue and Vite

Storybook for Vue 3 is a UI development environment for your Vue 3 components.
With it, you can visualize different states of your UI components and develop them interactively.

![Storybook Screenshot](https://github.com/storybookjs/storybook/blob/main/media/storybook-intro.gif)

Storybook runs outside of your app.
So you can develop UI components in isolation without worrying about app specific dependencies and requirements.

## Getting Started

```sh
cd my-vue3-app
npx storybook@latest init
```

For more information visit: [storybook.js.org](https://storybook.js.org)

---

Storybook also comes with a lot of [addons](https://storybook.js.org/addons) and a great API to customize as you wish.
You can also build a [static version](https://storybook.js.org/docs/sharing/publish-storybook) of your Storybook and deploy it anywhere you want.

## Extending the Vue application

Storybook creates a [Vue 3 application](https://vuejs.org/api/application.html#application-api) for your component preview.
When using global custom components (`app.component`), directives (`app.directive`), extensions (`app.use`), or other application methods, you will need to configure those in the `./storybook/preview.js` file.

Therefore, Storybook provides you with a `setup` function exported from this package, which receives as a callback your Storybook instance, which you can interact with and add your custom configuration.

```js
// .storybook/preview.js

import { setup } from '@storybook/vue3';

setup((app) => {
app.use(MyPlugin);
app.component('my-component', MyComponent);
app.mixin({
/* My mixin */
});
});
```
See [documentation](https://storybook.js.org/docs/8.0/get-started/vue3-vite?renderer=vue) for installation instructions, usage examples, APIs, and more.
6 changes: 3 additions & 3 deletions docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,9 @@ Vue 2 entered [End of Life](https://v2.vuejs.org/lts/) (EOL) on December 31, 202

<CodeSnippets
paths={[
'common/init-command-specific-version.npx.js.mdx',
'common/init-command-specific-version.yarn.js.mdx',
'common/init-command-specific-version.pnpm.js.mdx',
'common/storybook-init-v7.npx.js.mdx',
'common/storybook-init-v7.yarn.js.mdx',
'common/storybook-init-v7.pnpm.js.mdx',
]}
/>

Expand Down
6 changes: 3 additions & 3 deletions docs/get-started/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,9 @@ Vue 2 entered [End of Life](https://v2.vuejs.org/lts/) (EOL) on December 31st, 2

<CodeSnippets
paths={[
'common/init-command-specific-version.npx.js.mdx',
'common/init-command-specific-version.yarn.js.mdx',
'common/init-command-specific-version.pnpm.js.mdx',
'common/storybook-init-v7.npx.js.mdx',
'common/storybook-init-v7.yarn.js.mdx',
'common/storybook-init-v7.pnpm.js.mdx',
]}
/>

Expand Down
36 changes: 32 additions & 4 deletions docs/get-started/nextjs.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
title: Storybook for Next.js
---

export const SUPPORTED_RENDERER = 'react';

Storybook for Next.js is a [framework](../contribute/framework.md) that makes it easy to develop and test UI components in isolation for [Next.js](https://nextjs.org/) applications. It includes:

- 🔀 Routing
Expand All @@ -11,10 +13,24 @@ Storybook for Next.js is a [framework](../contribute/framework.md) that makes it
- 🎛 Webpack & Babel config
- 💫 and more!

<If notRenderer={SUPPORTED_RENDERER}>

<Callout variant="info">

Storybook for Next.js is only supported in [React](?renderer=react) projects.

</Callout>

<!-- End non-supported renderers -->

</If>

<If renderer={SUPPORTED_RENDERER}>

## Requirements

- Next.js >= 13.5
- Storybook >= 7.x
- Next.js 13.5
- Storybook 7.0

## Getting started

Expand All @@ -38,7 +54,7 @@ Follow the prompts after running this command in your Next.js project's root dir

### In a project with Storybook

This framework is designed to work with Storybook 7. If you’re not already using v7, upgrade with this command:
This framework is designed to work with Storybook 7+. If you’re not already using v7, upgrade with this command:

<!-- prettier-ignore-start -->

Expand Down Expand Up @@ -98,6 +114,14 @@ Finally, if you were using Storybook plugins to integrate with Next.js, those ar

<!-- prettier-ignore-end -->

## Run the Setup Wizard

If all goes well, you should see a setup wizard that will help you get started with Storybook introducing you to the main concepts and features, including how the UI is organized, how to write your first story, and how to test your components' response to various inputs utilizing [controls](../essentials/controls).

![Storybook onboarding](./example-onboarding-wizard.png)

If you skipped the wizard, you can always run it again by adding the `?path=/onboarding` query parameter to the URL of your Storybook instance, provided that the example stories are still available.

## Next.js's Image component

This framework allows you to use Next.js's [next/image](https://nextjs.org/docs/pages/api-reference/components/image) with no configuration.
Expand Down Expand Up @@ -920,7 +944,7 @@ The available options are:

Type: `Record<string, any>`

Configure options for the [framework's builder](../api/main-config-framework.md#optionsbuilder). For Next.js, that builder is Webpack 5.
Configure options for the [framework's builder](../api/main-config-framework.md#optionsbuilder). For Next.js, available options can be found in the [Webpack builder docs](../builders/webpack.md).

#### `image`

Expand All @@ -933,3 +957,7 @@ Props to pass to every instance of `next/image`. See [next/image docs](https://n
Type: `string`

The absolute path to the `next.config.js` file. This is necessary if you have a custom `next.config.js` file that is not in the root directory of your project.

<!-- End supported renderers -->

</If>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading