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

UI: Add initialActive option parameter #9141

Merged

Conversation

alexandre-lelain
Copy link
Contributor

@alexandre-lelain alexandre-lelain commented Dec 12, 2019

Issue: #9127

What I did

  • Added initialActive option parameter to storybook-ui config.
  • Active tabs in Mobile layout are now handled using constants instead of hardcoded numbers.
  • Updated Options Parameters doc page.

Users can now set the default active tab on Mobile.

How to test

To test this feature, simply set initialActive in the options of the storybook config, and check that the default active tab on Mobile matches your setup:

// config.js
...

/**
 * 'sidebar' - Sidebar
 * 'canvas' - Canvas
 * 'addons' - Addons
 */
const initialActive = X // one of above values
addParameters({
  options: {
     initialActive,
  },
})

@vercel
Copy link

vercel bot commented Dec 12, 2019

This pull request is being automatically deployed with ZEIT Now (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://zeit.co/storybook/monorepo/ge573viyc
✅ Preview: https://monorepo-git-fork-alexandre-lelain-feat-initialactivetaboption.storybook.now.sh

Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make constants for this, something like this:

export const ACTIVE = {
  SIDEBAR: 0,
  ...
}

Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make constants for this, something like this:

export const ACTIVE = {
  SIDEBAR: 0,
  ...
}

@alexandre-lelain
Copy link
Contributor Author

alexandre-lelain commented Dec 13, 2019

Thanks for the review 👍

You are right, we should use constants. I pushed the update @shilman

@alexandre-lelain
Copy link
Contributor Author

Hello @shilman , do you have any updates on this ? 🙏

@shilman shilman added this to the 6.0.0 milestone Dec 26, 2019
@shilman
Copy link
Member

shilman commented Dec 26, 2019

@alexandre-lelain yeah we're basically in feature freeze while we ship 5.3, which is in RC now and scheduled to ship in the first two weeks of january

@alexandre-lelain alexandre-lelain changed the base branch from next to next-6.0.0 December 26, 2019 16:39
Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYT about making these strings? Strings are self-documenting. Consider:

initialActive: 'sidebar'

vs

initialActive: 0

@alexandre-lelain
Copy link
Contributor Author

Yup you got a point 👍

Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💥 thanks!!

@kumarharsh
Copy link
Contributor

+1 for this feature. I was looking for a way to set the default tab when storybook first loads... Right now, it always loads Canvas no matter the order of the tabs.

@shilman shilman changed the title feat(ui, mobile): add initialActive option parameter UI: Add initialActive option parameter Feb 8, 2020
@shilman shilman merged commit 436d1cf into storybookjs:next Feb 8, 2020
@chavlji
Copy link

chavlji commented Nov 11, 2020

Setting initialActive isn't working for me. I've set it up in manager like this:

Screenshot 2020-11-11 at 14 30 54

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants