All language subtitles for 15. Tabs Overview

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian Download
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,720 --> 00:00:07,020 With our header really starting to take shape it's time to start getting into the main functionality 2 00:00:07,020 --> 00:00:14,130 of what the header is actually for and that is to provide a place for users to navigate between the 3 00:00:14,130 --> 00:00:17,420 different pages of our application. 4 00:00:17,420 --> 00:00:23,960 This is primarily done using tabs which are the little links at the top of the page in your header and 5 00:00:23,960 --> 00:00:32,900 material UI provides a tabs component that makes setting this up as well as managing some of the functionality 6 00:00:32,900 --> 00:00:40,860 required very easy just like it does everything else so let's just start by going through the material 7 00:00:40,860 --> 00:00:47,880 UI documentation for tabs and see what they kind of provide for us to begin with and then how we're 8 00:00:47,880 --> 00:00:50,640 going to then go and customize those ourselves. 9 00:00:51,620 --> 00:00:59,710 Here we are at the documentation page under components and then navigation and at the bottom tabs. 10 00:00:59,880 --> 00:01:06,890 Like I said tabs make it easy to explore and switch between different views or in other words the different 11 00:01:06,890 --> 00:01:09,790 pages within your application. 12 00:01:09,890 --> 00:01:17,120 So this is obviously exactly what we want and if you come down and look at the simple tabs example you'll 13 00:01:17,120 --> 00:01:22,200 see something very familiar to the header design that we are trying to build. 14 00:01:22,340 --> 00:01:30,890 You see the links each with their name and you can also see here that the active tab is not only highlighted 15 00:01:30,980 --> 00:01:39,170 on the label but it also has a little extra strip of color signifying that that is the active tab when 16 00:01:39,170 --> 00:01:46,220 you click on to a another tab you'll see the little animation as the inline moves over and the highlight 17 00:01:46,250 --> 00:01:49,490 changes to indicate the newly updated tab. 18 00:01:50,550 --> 00:01:57,360 If we want to go and take a look at how this is actually working we can open up the source and the main 19 00:01:57,360 --> 00:02:06,240 imports up here to be aware of are the tabs component and the TAB component so you can see one is plural 20 00:02:06,420 --> 00:02:08,100 and one is not. 21 00:02:08,100 --> 00:02:10,920 And we use both of these to set this up. 22 00:02:11,880 --> 00:02:21,970 Down below you'll find where they have implemented the tabs right here setting the tabs component first 23 00:02:22,420 --> 00:02:30,050 and then putting each tab within that each tab then has a label. 24 00:02:30,050 --> 00:02:37,830 And if that is what changes the text that is displayed here on the tab itself. 25 00:02:37,880 --> 00:02:42,760 So that text right there is coming from our own label prop. 26 00:02:43,040 --> 00:02:49,860 And then on our tabs component we have the value and on change props. 27 00:02:50,030 --> 00:02:58,100 These are what keep track of and manage which tab is selected giving us the highlight and the little 28 00:02:58,280 --> 00:03:08,820 indicator down here the way that this is actually managed is by using this value and set value hook 29 00:03:09,150 --> 00:03:12,230 with the use state function. 30 00:03:12,270 --> 00:03:21,810 This creates a state value of value and it sets value equal to a default of 0 and then gives us the 31 00:03:21,810 --> 00:03:26,310 function set value to change this state. 32 00:03:26,340 --> 00:03:34,860 This is essentially a shorthand for this dos set state using the new react hook API. 33 00:03:34,860 --> 00:03:41,340 We then pass that value to our tabs component as the value prop. 34 00:03:41,430 --> 00:03:47,680 And this is a number specifying the index of the currently selected tab. 35 00:03:48,060 --> 00:03:51,930 So you can see when we set a default of 0. 36 00:03:51,990 --> 00:04:02,690 That means that the tab in the 0 with position will be passed to our tabs value prop as the active tab. 37 00:04:03,000 --> 00:04:10,830 Then we have our on change which is past the handle change function that is defined here which then 38 00:04:10,830 --> 00:04:20,310 takes our event and the new value which is the index of the new we selected tab and uses the set value 39 00:04:20,310 --> 00:04:29,620 hook to set that new state value when the newly selected tab value is passed to the state. 40 00:04:29,670 --> 00:04:35,520 It then causes a re render which then displays the content from the new tab. 41 00:04:35,550 --> 00:04:40,040 So here you can see that every time we click the other tabs. 42 00:04:40,110 --> 00:04:47,010 So if we flick back and forth every time that we click on one of these tabs the on change handler is 43 00:04:47,010 --> 00:04:54,330 being called and is passing the index of whichever tab we have clicked on to the set value function 44 00:04:54,600 --> 00:05:03,120 which then the sets are state to that selected tab which then renders the content down below now and 45 00:05:03,120 --> 00:05:10,800 here they actually use the tab panel to display the content below which is connected to the values. 46 00:05:10,800 --> 00:05:17,490 And here you can see the specified indices but we are actually going to integrate this with react router 47 00:05:17,730 --> 00:05:22,190 and that is going to manage changing the content on the screen for us. 48 00:05:22,970 --> 00:05:27,020 Managing the active tab however will still be the same. 49 00:05:27,140 --> 00:05:36,760 And so we'll be using this value and set value hook to give us that functionality if we move on past 50 00:05:36,790 --> 00:05:40,190 the simple tabs example and we scroll down. 51 00:05:40,300 --> 00:05:46,060 We can take a look at some of the other options for tabs that material UI provides to us which there 52 00:05:46,060 --> 00:05:50,190 are plenty of we'll just kind of go through some of these. 53 00:05:50,260 --> 00:05:56,080 But if you are interested remember to just come and check out the source code and you can see which 54 00:05:56,080 --> 00:06:04,230 props and what other components they may be using to get some of the functionality that you see here. 55 00:06:04,380 --> 00:06:13,200 For example for the wrapped text or wrapped labels example here you'll find they use the wrapped prop 56 00:06:13,560 --> 00:06:19,830 on the tab component which makes it wrap this text instead of cutting it off. 57 00:06:19,920 --> 00:06:26,730 You can also see that you can set some tabs to disabled so I can select the active tab active tab but 58 00:06:26,730 --> 00:06:30,810 I can not select this tab in the middle that is disabled. 59 00:06:30,840 --> 00:06:38,460 So you could imagine programmatically checking whether or not a user has access to a certain tab or 60 00:06:38,460 --> 00:06:44,200 setting and then disabling or enabling that based on those permissions. 61 00:06:44,210 --> 00:06:51,860 There's also the full width variant which will make your tabs take up the entire length of the bar and 62 00:06:51,860 --> 00:06:58,400 then below we have the centered prop which squeezes all of your tabs into the center of your toolbar 63 00:06:58,460 --> 00:07:01,680 or app bar if you have lots of tabs. 64 00:07:01,690 --> 00:07:09,340 Then you might need to be able to scroll them so you see here if I actually go and shrink down the window 65 00:07:09,340 --> 00:07:17,600 size you can see the scroll arrow appear and now I can click that to scroll the items back and forth. 66 00:07:18,500 --> 00:07:23,600 If you want to always be able to scroll you can set a forced scroll option. 67 00:07:23,600 --> 00:07:28,890 And now that is always available regardless of how big the viewport size is. 68 00:07:28,910 --> 00:07:31,930 So you can see I can expand back up and it's still there. 69 00:07:32,710 --> 00:07:38,080 If you want to be able to scroll but you don't want those little arrows there you can turn them off 70 00:07:38,410 --> 00:07:42,810 and now the user will just have to know to scroll or swipe on their own. 71 00:07:42,850 --> 00:07:50,280 And if I go ahead and shrink this down again and then head back down you can see that now I have the 72 00:07:50,280 --> 00:07:55,800 ability to scroll even though the little scroll bars are not there. 73 00:07:55,800 --> 00:08:01,980 Further down you can see that they give examples on how to customize the tabs but we are actually going 74 00:08:01,980 --> 00:08:08,610 to be doing that as well in the next video but they also have the ability to have vertical tabs. 75 00:08:08,640 --> 00:08:15,690 If you need and so you could see that this allows you to do a multitude of different navigation options 76 00:08:15,720 --> 00:08:20,470 depending on whichever is most appropriate for your application. 77 00:08:20,550 --> 00:08:27,780 Here's a another example of how you can actually do navigation by changing these tabs into links but 78 00:08:27,780 --> 00:08:31,280 again we're going to be using react router for that. 79 00:08:31,320 --> 00:08:35,310 And so I'm going to walk you through that process as well. 80 00:08:35,310 --> 00:08:42,450 Lastly they just want to show you that you can actually use icons so just icons or you can add tabs 81 00:08:42,450 --> 00:08:44,800 with text and icons as well. 82 00:08:44,800 --> 00:08:52,080 So whichever style or feel for your application that you want or that you feel would be best for your 83 00:08:52,080 --> 00:08:59,610 users you can see material UI provides a ton of different scaffolding for you then to build on and customize 84 00:08:59,790 --> 00:09:04,770 for whatever specific situation your project might call for. 85 00:09:04,770 --> 00:09:11,190 So the things to really remember and take away is just remember we have our tabs components which then 86 00:09:11,190 --> 00:09:16,580 wraps each individual tab which we then set the label to give. 87 00:09:16,600 --> 00:09:24,660 R text that we want to be displayed and then the tabs component has a value and then on change handler 88 00:09:24,900 --> 00:09:32,370 which manages the index of which tab is selected so you know all the different options that there are 89 00:09:32,370 --> 00:09:37,210 four tabs now and I think that the structure is pretty simple for getting this setup. 90 00:09:37,230 --> 00:09:42,710 So let's go ahead and in the next video we're going to start implementing this in our own application. 10909

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.