Storybook: Not possible to display controls if using a custom `page` function?

Created on 29 Jul 2020  路  3Comments  路  Source: storybookjs/storybook

Describe the bug
It's either not possible or not documented as to how we can display controls in addon-docs's <Props/> block if using a custom docs.page parameter.

To Reproduce
Steps to reproduce the behavior:

  1. Define a custom page function for addon docs in preivew.js e.g.:

javascript addParameters({ docs: { source: { type: "code", } , page: () => { return ( <> <Title /> <Subtitle /> <Primary /> <Description /> <Props /> <Stories includePrimary /> </> ); }, }, });

  1. Create an args story
  2. Confirm you can see controls tab in canvas view
  3. Check props table in docs page -> No prop types.

Expected behavior
The docs for addon-docs suggest that if using a CSF, props table automatically shows controls if they are there, so I'd expect that to happen.

If this is not possible, it should probably be indicated here and here

docs question / support

Most helpful comment

FYI, we're renaming the blocks and making ^ the default in ArgsTable. You can still opt in to the old behavior with of='.'. See https://github.com/storybookjs/storybook/pull/11744

All 3 comments

To set controls for the primary story:

<Props story="^" />

Perfect, that's the one. I've also found this in the source so for anyone else who finds this in future you can also pass . to use the selected story (select via the sidebar).

@shilman thanks again for helping me out - really enjoying SB6.

FYI, we're renaming the blocks and making ^ the default in ArgsTable. You can still opt in to the old behavior with of='.'. See https://github.com/storybookjs/storybook/pull/11744

Was this page helpful?
0 / 5 - 0 ratings

Related issues

purplecones picture purplecones  路  3Comments

tlrobinson picture tlrobinson  路  3Comments

Jonovono picture Jonovono  路  3Comments

arunoda picture arunoda  路  3Comments

tomitrescak picture tomitrescak  路  3Comments