-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[Tabs] Make the <Tabs /> component scrollable like <paper-tabs/> in polymer's paper-elements #1148
Comments
+1 this would be cool |
+1 would be a nice feature to support small screen devices. |
Hi all, I have implemented responsive tabs in one of my projects. I plan to contribute it to the main repo. Here is a demo. |
@fredriklindell Wow they're awesome. We'd love to see the PR 👍 👍 😄 |
Hi @alitaheri, glad to hear that you like it :) I have uploaded an initial commit. You can find it here. However I have two things that I would like to change, I just don't know exactly how. Maybe some of you have run into the same problem. I need the size of each tab, the only way to read it is after the tab has been added to the DOM. However you are not allowed to do DOM operation in the render function. So I do this in componentWillUpdate - due to that I need them in the render function. First thought was to have the tab info in the state, but you are not allowed to change the state in componentWillUpdate - this forced me to use global variables. Which is not best practice, but it solves the problem. How would you have solved it? Thanks in advance! |
@fredriklindell Thanks a lot for working on this 👍 👍 That's an XY Problem why would you need to know the size of each tab when they are rendered? If it's to see how they will measure themselves then you can put refs on them and get the size in Still, why do you want the size? isn't flexbox flexible enough? 😄 P.S. there is a better way than globals. you can always add more instance fields 😁 |
@alitaheri Thanks for your suggestions regarding componentDidMount - I will try that during the evening. I need the width of each tabs since they might not always be equally depending on the text and since it is impossible (what I know of) to calculate the width of a text that depends on which font is used. The main reason to why I need the width is to be able to move the InkBar into the right position and also set the the scroll of the wrapper. Maybe there is some way to solve this better that I am unaware of. P.S what do you mean with instance field? :) |
@alitaheri I have re-written and removed the global vars and the setState in componentDidUpdate. I now listen to window resize change and replace the state and I do the same in componentDidMount. Please have a look at the commit here. |
Why not just opening a pull request here :)? |
@oliviertassinari will do, just running it through some friends before the pull request :) |
Hi, Could anyone explain what I need to do in order to get the development server docs for tabs to work. If I run below command:
When above command has finished, without errors, I try to browse to Tabs component demo, but I get below error.
Any idea to what I have to fix? Thanks in advance! |
That's an issue with |
@oliviertassinari it's on my branch which was rebased against master 2016-01-04 i think. Do you know how to solve it? Or is it maybe fixed on master branch? |
You are probably using a code structure that react-docgen don't like. I can't tell you without seeing the code. Just open a PR. |
@oliviertassinari I will create a PR on Sunday. Found some things I would like to change before. |
This commit implements request in below issue: mui#1148 When device width is less than 992 tabs will paginate if the tab container width is wider than device sreen width.
This commit implements request in below issue: mui#1148 When device width is less than 992 tabs will paginate if the tab container width is wider than device sreen width.
@oliviertassinari PR created if you haven't noticed already. |
@fredriklindell Awesome, I will have a look. |
This commit implements request in below issue: mui#1148 When device width is less than 992 tabs will paginate if the tab container width is wider than device sreen width.
This commit implements request in below issue: mui#1148 When device width is less than 992 tabs will paginate if the tab container width is wider than device sreen width.
This commit implements request in below issue: mui#1148 When device width is less than 992 tabs will paginate if the tab container width is wider than device sreen width.
I've placed a (small) bounty on this at https://www.bountysource.com/issues/24249589-tabs-make-the-tabs-component-scrollable-like-paper-tabs-in-polymer-s-paper-elements, if it makes anyone want to take a look at this. |
@oliviertassinari Is there an ETA on this? We need this urgently in one of our projects and are willing to help :) |
There is not ETA. If you really need this feature asap, you are on your own. The best thing to do is to build it for your needs. Once you are happy with it, would be awesome to merge it back in this repository 👍. |
Any updates? |
+1 |
Would also be cool to support the second version of the scrollable tabs, which reduce the overflowing tabs into one. https://material.google.com/components/tabs.html#tabs-types-of-tabs |
I've posted a repo and npm package to implement the scrollable tabs behavior. The package is a true extension of material-ui - it has material-ui as a dependency to do most of the heavy lifting. I plan on working this up to create a PR for material-ui with, but there's some additional work I need to do to make that happen (tests, docs, etc.). In the meantime, feel free to try it out and any feedback is appreciated! |
@shawnmcknight Thanks for sharing the project. That could help people looking at the issue.
|
@oliviertassinari I will tackle item 1 above sometime next week and update this thread when I have something. Once I have that, I'll get myself familiar with the differences in the next branch and what features are being requested. I've developed a pretty good familiarity with the material design specs for tabs as I've worked up my project, so I think I can be of some help with getting the next branch up to snuff. I assume #4795 is the path forward? |
@shawnmcknight Yes, it is. We are glad you are willing to lead the effort for improving the |
Today I posted an update to the GitHub repo and npm package for material-ui-scrollable-tabs. No major functionality changes, but I have added an interactive demo based on Material-UI documentation components. I've attached a screenshot below of the example site in action if anybody is interested. I'm in the process of working through a feature update for that project to improve some of its functionality to make sure I've got a working model there before moving on to the next branch work. @oliviertassinari I'm assuming this should satisfy the "demo" request quoted above. If so, what's the best bet to get this added as a related project? I can create a PR adding it if that helps things. |
That would be great! 👍 |
Would it be possible to make a PR on 0.X.X branch as well ? |
@remi13131 We only prioritize bug fixes for the |
I understand. Thanks anyway for this great work. |
@remi13131 I would say months for the stable release, for now, we are releasing alpha versions. |
uhfiuewri |
The polymer paper-elements library contains a tab bar that is scrollable (see example E. https://elements.polymer-project.org/elements/paper-tabs?view=demo:demo/index.html).
Is it possible to support this scrollable property for the tab bar in material-ui?
The text was updated successfully, but these errors were encountered: