Skip to content

Commit

Permalink
Clarify subcomponents limitations
Browse files Browse the repository at this point in the history
  • Loading branch information
kylegach committed Jan 30, 2024
1 parent b644216 commit de25f2e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/writing-stories/stories-for-multiple-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ Note that by adding a `subcomponents` property to the default export, we get an

![Subcomponents in ArgTypes doc block](./doc-block-arg-types-subcomponents-for-list.png)

The downside of the approach used above, where each story creates its own combination of components, is that it does not take advantage of Storybook [Args](../writing-stories/args.md) meaning:
Subcomponents are only intended for documentation purposes and have some limitations:

1. You cannot change the stories via the controls panel
2. There is no [args reuse](../writing-stories/index.md#using-args) possible, which makes the stories harder to maintain.
1. The [argTypes](../api/arg-types.md) of subcomponents are [inferred (for the renderers that support that feature)](../api/arg-types.md#automatic-argtype-inference) and cannot be manually defined or overridden.
2. The table for each documented subcomponent does _not_ include [controls](../essentials/controls.md) to change the value of the props, because controls always apply to the main component's args.

Let's talk about some techniques you can use to mitigate the above, which are especially useful in more complicated situations.

Expand Down

0 comments on commit de25f2e

Please sign in to comment.