# Update storybook to support stories for individual components \(\#3010\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/66358f2900cf3c2ec2d42b169d81b012c8642e7e)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 66358f2900cf3c2ec2d42b169d81b012c8642e7e

Requested commit: 66358f2900cf3c2ec2d42b169d81b012c8642e7e

Commit: 66358f2900cf3c2ec2d42b169d81b012c8642e7e

Tree: 49853f2a596404dae85b4ae39134d98547da19a3

Author: Marshall Bowers

Committer: GitHub

## Message

````
Update storybook to support stories for individual components (#3010)

This PR updates the `storybook` with support for adding stories for
individual components.

### Motivation

Right now we just have one story in the storybook that renders an entire
`WorkspaceElement`.

While iterating on the various UI components, it will be helpful to be
able to create stories of those components just by themselves.

This is especially true for components that have a number of different
states, as we can render the components in all of the various states in
a single layout.

### Explanation

We achieve this by adding a simple CLI to the storybook.

The `storybook` binary now accepts an optional `[STORY]` parameter that
can be used to indicate which story should be loaded. If this parameter
is not provided, it will load the workspace story as it currently does.

Passing a story name will load the corresponding story, if it exists.

For example:

```
cargo run -- elements/avatar
```

<img width="723" alt="Screenshot 2023-09-21 at 10 29 52 PM"
src="https://github.com/zed-industries/zed/assets/1486634/5df489ed-8607-4024-9c19-c5f4541f97c9">

```
cargo run -- components/facepile
```

<img width="785" alt="Screenshot 2023-09-21 at 10 30 07 PM"
src="https://github.com/zed-industries/zed/assets/1486634/e04a4577-7403-405d-b23c-e765b7a06229">



Release Notes:

- N/A
````

## Parents

- [4628639ac6b955052a4304847c6b67bb5168c298](https://git.cafe/gitcafe/zed/commit/4628639ac6b955052a4304847c6b67bb5168c298?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/66358f2900cf3c2ec2d42b169d81b012c8642e7e?format=markdown)
