Skip to content

Commit

Permalink
Merge pull request #14450 from avaly/patch-1
Browse files Browse the repository at this point in the history
Document support for stories as function
  • Loading branch information
shilman authored Apr 2, 2021
2 parents b499cf4 + f694c26 commit 0cbd527
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docs/configure/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,21 @@ For example if you wanted to pull both `.md` and `.js` files from the `my-projec

<!-- prettier-ignore-end -->

If you want to use a custom logic for loading stories which is not supported by a glob pattern, you can supply the final list of stories files:

```js
// .storybook/main.js

function findStories() {
// your custom logic returns a list of files
}

module.exports = {
stories: async (list) => [...list, ...findStories()],
};
```


## Configure story rendering

To control the way stories are rendered and add global [decorators](../writing-stories/decorators.md#global-decorators) and [parameters](../writing-stories/parameters.md#global-parameters), create a `.storybook/preview.js` file. This is loaded in the Canvas tab, the “preview” iframe that renders your components in isolation. Use `preview.js` for global code (such as [CSS imports](../get-started/setup.md#render-component-styles) or JavaScript mocks) that applies to all stories.
Expand Down

0 comments on commit 0cbd527

Please sign in to comment.