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

Add storybook intro #45115

Merged
merged 6 commits into from
Oct 20, 2022
Merged
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
35 changes: 34 additions & 1 deletion storybook/stories/docs/introduction.story.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,37 @@ import { Meta } from '@storybook/addon-docs';

# Introduction

Hello World
## Welcome!

The WordPress Gutenberg project uses Storybook to view and work with the UI components developed in the WordPress package [@wordpress/components](https://github.com/WordPress/gutenberg/tree/trunk/packages/components).

On this interactive site you can browse individual components, their controls, options, and settings in isolation. You can also modify controls and arguments and see the changes right away.

The components displayed on this site can be used in your code to build the editor's UI for your custom blocks or other pages.
Import them from the components root directory like in below example:

```jsx
import { Button } from '@wordpress/components';

export default function MyButton() {
return <Button>Click Me!</Button>;
}
````

## How this site works

The site shows the individual components in the sidebar and the Canvas on the right. Select the component you’d like to explore, and you’ll see the display on the Canvas tab. If the component also has controls/arguments, you can modify them on the Controls tab on the lower half of the screen.

To view the documentation for each component use the **Docs** menu item in the top toolbar.

To use it in your local development environment run the following command in the top level Gutenberg directory:

```bash
npm run storybook:dev
```

## Resources to learn more:

- [Storybook.js.org](https://storybook.js.org/) - Storybook is a frontend workshop for building UI components and pages in isolation.
- [[Package] Components](https://github.com/WordPress/gutenberg/issues?q=is%3Aopen+is%3Aissue+label%3A%22%5BPackage%5D+Components%22) - Open Issue Gutenberg Repo
- [On the known "loading source..." issue](https://github.com/WordPress/gutenberg/issues/45095) at the 'Story' tab for some components