Skip to content

Commit

Permalink
Document support for stories as function
Browse files Browse the repository at this point in the history
  • Loading branch information
avaly authored Apr 2, 2021
1 parent b499cf4 commit f694c26
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 f694c26

Please sign in to comment.