Storybook is widely used by component libraries and design systems. Design system authors can automatically compose their design systems inside their consumer’s Storybooks.
For example, if you use a design system package, its stories can appear alongside your own. That makes it convenient to cross reference usage documentation without leaving Storybook.
Composition happens automatically if the package supports it. When you install the package, Storybook will load its stories alongside your own.
If you want to configure how the composed Storybook behaves, you can disable the
ref element in your
Change the version of the composed Storybook to see how the library evolves. This requires configuration from the package author.
Component library authors can expand adoption by composing their components in their consumer’s Storybooks.
storybook property in your published
package.jsonthat contains an object with a
url field. Point the URL field to a published Storybook at the version you want.
If you are using a CHP level 1 service for hosting (such as Chromatic.com), you can provide a single URL for your Storybook in the
storybook.url field. You do not need to change the URL each time you publish a new version. Storybook will automatically find the correct URL for your package.
For example, for Chromatic, you might do:
In this example
xyz123 is your project’s id. Storybook will automatically compose in the Storybook published to that project corresponding to the version the user has installed.
Storybook can communicate with services that host built Storybooks online. This enables features such as Composition. We categorize services via compliance with the "Component Hosting Protocol" (CHP) with various levels of support in Storybook.
The service serves uploaded Storybooks and makes the following available:
version=x.y.zquery parameter (where
x.y.zis the released version of the package).
Examples of such services: chromatic.com.
The service can serve uploaded Storybooks. There is no special integration with Storybook APIs.