-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
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
fix(theme): <Tabs>
props should allow overriding defaults
#10091
Conversation
By switching the priority of inner properties (`...tabs`) with input properties (`...props`), we allow the users to control the `selectedValue` (i.e. switch tabs), as well as to pass a hook `selectValue` to act on a tab switch. This is a minor change that should improve UX while not changing anything else.
Hi @gagdiez! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
✅ [V2]Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
⚡️ Lighthouse report for the deploy preview of this PR
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
<Tabs>
props should allow overriding defaults
Thanks Ok to do this change, although I'm not sure I'd want to recommend this pattern considering you can mess up with internals. Note that we won't expose the 3 things you can now override in the TS typedefs, to prevent most users from using those props. I'm really curious to know how you plan to use those props. Are you also using our internal |
@slorber I needed this to make my tabs change as the user scrolls through the docs: PREVIEW: https://docs-preview-pr-1919.onrender.com/build/smart-contracts/anatomy/
|
😄 I see Maybe it would be simpler to use your own tab component instead, we provide one for convenience but you can also create your own if it's not good enough for your advanced use case. |
Pre-flight checklist
Motivation
By switching the priority of inner properties (
...tabs
) with input properties (...props
), we allow the users to control theselectedValue
(i.e. switch tabs), as well as to pass a hookselectValue
to act on a tab switch.This is a minor change that should improve UX while not changing anything else.
Test Plan
Existing tests should suffice, since no major change was introduced, only the place of the variables was swapped to give higher priority to the input props
Test links
https://deploy-preview-10091--docusaurus-2.netlify.app/docs/markdown-features/tabs/
Related issues/PRs
Related to this feature request: https://docusaurus.io/feature-requests/p/pass-active-attribute-to-tab-children