Uh oh!
There was an error while loading. Please reload this page.
Improved Tabs component - #213
Conversation
kyleabeauchamp
commented
Jun 21, 2018
I noticed that the changes to dash-core-components/test/test_integration.py Line 219 in 7b6b5ff |
valentijnnieman
commented
Jun 21, 2018
@kyleabeauchamp Good point - although the old integration tests aren't applicable here because I've changed the component API a bit, some integration testing with the new components would be nice! |
kyleabeauchamp
commented
Jun 21, 2018
I have an open PR as well that attempts this, FWIW. |
freshwuzhere
commented
Jun 21, 2018
This looks AWESOME! Thanks |
valentijnnieman
commented
Jun 21, 2018
@kyleabeauchamp Whoops, sorry, didn't see your PR in time :) |
kyleabeauchamp
commented
Jun 21, 2018
One more naive question: is rebuilding and committing bundle.js part of the PR process? I suspect that would facilitate testing this branch (for those of us too lazy to get a fully working dev environment). |
valentijnnieman
commented
Jun 22, 2018
@kyleabeauchamp Good question - I wasn't sure about this (couldn't find any documentation about it) but I think you're right, looking back at older PR's it looks like the build is included, and I forgot to update the version as well, so I've now done that. Thanks for your help! :) |
ZeroCool2u
commented
Jun 22, 2018
This is beautiful. I'm a big fan of the dual component design. Great work! |
kyleabeauchamp
commented
Jun 22, 2018
Thanks, with the latest commits I can now import the |
lilianeolmos
commented
Jul 24, 2018
Hi @valentijnnieman ! I'm having an issue: when I select the tab for the first time, the layout is correct , but when I switch tabs and then return to it, the layout has been messed up: |
chriddyp
commented
Jul 24, 2018
@valentijnnieman - I'm OK with these styles being merged into the defaults, but what I'm concerned about is that the selected styles seem to be mutated after I've clicked on them. Here is the same GIF but annotated: Step 2 - Click on Tab #3. Step 3 - Click on Tab #1. Note how Tab #3 now has a left and top border. It shouldn't have any borders, it should appear the same way as it appears in Step 1. It seems like the style is getting mutated rather than copied. Similarly, note how in Step 2, Tab #1 has left and top borders. This is unexpected, it shouldn't have any borders. Does that make sense or am I missing something here? |
valentijnnieman
commented
Jul 25, 2018
@chriddyp Sorry, I missed that completely when watching your gif :) I'll take a look at it! |
valentijnnieman
commented
Jul 25, 2018
@chriddyp I made a mistake where I copied the styles over - thus leaving styles that were being appended (from |
valentijnnieman
commented
Jul 25, 2018
@lilianeolmos Hmm that's odd! I've just published prerelease version |
lilianeolmos
commented
Jul 25, 2018
@valentijnnieman thanks for your answer. I've just tried and I'm still having the same problem. When I use the previous versions of dash_core_components this problem doesn't happen. |
valentijnnieman
commented
Jul 25, 2018
@lilianeolmos Hmm! Would you perhaps create a post on our forums, here with a short reproducible example code of the bug? Would help us out a lot! |
chriddyp
commented
Jul 25, 2018
Thanks for making this changes! Let's do this 😸 💃 💃 💃 |
danigallo
commented
Jul 27, 2018
@valentijnnieman is there a way to change the tab sizes/length? I have 4 and one is carrying over to a new row |
valentijnnieman
commented
Jul 27, 2018
@danigallo You could specify the |
ghost
commented
Jul 31, 2018
Thanks for all your work on the new Tabs functionality. My apps still use the old one from the 0.21.rc1 release and was wondering if it would be safe to switch over for my use case. Typically, each tab's content takes 20 seconds or so to load because of internal data fetching, computation and rendering of a complicated plotly Figure. Additionally, most tabs are never used during a given session, so the content never needs to be generated. Would the new component slow down the app? |
chriddyp
commented
Jul 31, 2018
It will not, you can still use the previous method "generate content through a callback" with the new tabs component. This is what I recommend for most use cases. See the second example here: https://dash.plot.ly/dash-core-components/tabs |
Hi Fairly new to Plotly and Dash but loving what I can do with it so far! Have started experimenting with tabs and I have two tabs, but when I load my dashboard it opens my "second" tab as the first tab you see. Is there a way to set tab1 as the "default" tab that should be displayed first? Have done a fair bit of searching but can't see it covered anywhere. Thanks Chris |
robfraz
commented
Aug 2, 2018
@Chris3691 Yes there is. Look at the code example in this earlier comment where a bug (now resolved) was spotted with this default tab functionality. You'll see each |
chriddyp
commented
Aug 2, 2018
We have published the documentation for this component online here: https://dash.plot.ly/dash-core-components/tabs. Many thanks to everyone who has contributed to this effort! If you have any other questions or issues with this component, please create a new issue or discuss in the community forum https://community.plot.ly/c/dash |




Hello there!


Here is the improved Tabs component I've been working on, branched off the current master branch. It supports className's and inline style's for the multiple containers (parent, tabs, tab, tab-content, tab--selected) which appends classes to the base classes (let me know if it should overwrite the default classes instead of appending) and has a
verticalbool for rendering vertically.It's also more responsive:

It's basically 2 components: a
dcc.Tabscomponent which is the container, where you can specifyverticaland set some classes and styles, and adcc.Tabcomponent, which renders a tab with alabel, and renders it'schildren(which can be anything in Dash) when that tab isselected! Thanks to @T4rk1n for his work and ideas!Here's an example of how to use Tabs:
I haven't included any builds yet, because I'm not sure if I should - CircleCI etc will handle that stuff, right?edit:
Please be aware that the component API has changed a bit - it now uses 2 components:
childrenas tabs, complete with selection logic - you no longer have to set this up yourself in Dash, it's handled internally, which I hope is more easy to use. Would love to hear some feedback on this, especially if this is giving you trouble or prevents a certain use case for you.labelprop that holds the label of the tab's button, and renders it'schildrenas the content that will be visible when this tab is selected