MCPcopy Index your code
hub / github.com/agenticaivc/docz-plugin-storybook

github.com/agenticaivc/docz-plugin-storybook @v0.5.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.5.2 ↗ · + Follow
55 symbols 172 edges 39 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

docz-plugin-storybook

Docz plugin that makes migrating from Storybook a breeze.

NPM Build Status JavaScript Style Guide

Overview

This plugin allows you to take any existing Storybook project and effortlessly view all of your stories in Docz.

Why?

Storybook's pretty great. Writing "stories" at the component level is a very powerful abstraction, and it has benefitted from enormous popularity within the React community.

Storybook does, however, have some flaws. The docs generally provide a great developer experience but are not ideal for design systems targeting designers or other business stakeholders. Storybook sites also tend to look pretty boring and you can't currently use MDX, a transformative technology that makes writing documentation in addition to component demos extremely fast and concise.

This is where Docz comes in -- it's already a really popular project that allows developers to write better component docs faster.

Given the popularity of these two projects, we wanted to provide a simple bridge which allows you to use existing Storybook stories from within Docz just by installing a plugin.

Features

  • import and render existing stories in Docz
  • zero config - it just works for 99% of Storybooks
  • automatically populate Docz with all of your stories
  • simple to use Docz alongside Storybook
  • no need to replace Storybook or force devs to change their habits
  • the best of both worlds - Docz :heart: Storybook

Install

This module requires node >= 6.

npm install --save-dev docz docz-plugin-storybook

Usage

Let's start with an existing project that uses Storybook.

  1. Add docz to your project following the normal docz getting started guide. You should now have blank docz docs alongside your existing storybook docs.

  2. Add the plugin to your doczrc.js

// doczrc.js
import { storybook } from 'docz-plugin-storybook'

export default {
  plugins: [
    storybook()
  ]
}
  1. ~~Start docz and view all your existing stories that've been automatically imported -- complete with all the hot reloading and mdx goodness that makes Docz so great!~~ Once #7 is resolved, all of your stories will automatically be populated within Docz. Until then, you'll need to manually render your stories within mdx files as the next section explains.

Manual Rendering

You can render any of your stories within Docz mdx files by using the Story or Stories React components.

// button.mdx
---
name: Button
---

import { Story, Stories } from 'docz-plugin-storybook/dist/react'

## Render one Button story

<Story kind='Button' name='with text' />

## Render all Button stories

<Stories kind='Button' />

This would display all of the stories loaded from this example Storybook file:

// button-story.js
import React from 'react'
import { storiesOf } from '@storybook/react'
import Button from '../components/Button'

storiesOf('Button', module)
  .add('with text', () => (
    <Button>Hello Button</Button>
  ))
  .add('with some emoji', () => (
    <Button>
      <span role={'img'} aria-label={'so cool'}>
        😀 😎 👍 💯
      </span>
    </Button>
  ))

The source files containing your stories can exist anywhere as long as they're loaded from Storybook's main entrypoint which defaults to .storybook/config.js.

Also note that these stories are loaded and exposed automagically by the plugin! 🤯

FAQ

See #11 for a detailed FAQ, including answers to why Docz and Storybook solve two different problems, how this plugin works, and how to customize your stories further.

Status

See #12 for a detailed breakdown of the current roadmap. In short, this module is stable and works well with manual Story rendering from within Docz, but populating Docz's contents automatically, story isolation, and custom webpack configs are an active WIP.

Related

  • storybook - The old component library framework.
  • docz - The new hotness based on mdx.

License

MIT © Hydrate

Core symbols most depended-on inside this repo

generateLinearData
called by 13
examples/react-vis/storybook/storybook-data.js
generateScatterplotData
called by 6
examples/react-vis/storybook/storybook-data.js
random
called by 5
examples/react-vis/storybook/storybook-data.js
storybook
called by 4
src/index.js
intRandom
called by 4
examples/react-vis/storybook/storybook-data.js
dataGenerator
called by 4
examples/react-vis/storybook/barseries-story.js
resolveApp
called by 2
src/paths.js
render
called by 2
src/react/Story.js

Shape

Function 26
Method 21
Class 8

Languages

TypeScript100%

Modules by API surface

src/shim/story-store.js20 symbols
examples/react-vis/storybook/storybook-data.js10 symbols
src/shim/client-api.js4 symbols
src/react/Story.js3 symbols
src/react/Stories.js3 symbols
src/index.js3 symbols
src/shim/index.js2 symbols
examples/react-vis/storybook/barseries-story.js2 symbols
test/fixtures/Button.js1 symbols
src/paths.js1 symbols
src/default-wrapper.js1 symbols
examples/react-vis/storybook/radial-story.js1 symbols

For agents

$ claude mcp add docz-plugin-storybook \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page