Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: add detail to addon-contexts per-story settings #10112

Merged
merged 1 commit into from
Mar 12, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions addons/contexts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,36 @@ export default {
};
```

Finally, you may want to modify the default setups at per story level. Here is how you can do this:
Finally, you may want to create new contextual environments or disable default setups at the story level. To create a new contextual environment at the story level:

```js
export const defaultView = () => <div />; // sample story in CSF format
defaultView.story = {
parameters: {
contexts: [{ /* contextual environment defined using the API below */ }]
}
};
```

To disable a default setup at the story level:

```js
export const defaultView = () => <div />;
defaultView.story = {
parameters: {
contexts: [{}]
contexts: [
{
title: '[title of contextual environment defined in contexts.js]'
options: { disable: true }
}
]
}
};
```

To override the default option for a default setup at the story level, see [this suggestion](https://discordapp.com/channels/486522875931656193/501692020226654208/687359410577604732).


## ⚙️ Setups

### Overview
Expand Down