All language subtitles for 2. TextField Overview

af Afrikaans
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
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
tl Filipino
fi Finnish
fr French
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian Download
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:01,110 --> 00:00:08,760 The text field component is pretty integral to the next two pages that we're going to be building both 2 00:00:08,790 --> 00:00:14,490 the contact page as well as the Free Estimate page. 3 00:00:14,510 --> 00:00:20,510 That means we need to definitely be comfortable with it and make sure that we're aware of all of the 4 00:00:20,510 --> 00:00:28,590 functionality that it has to offer us let's start then by going over to the material UI documentation 5 00:00:28,920 --> 00:00:33,640 and we'll walk through all the options. 6 00:00:33,750 --> 00:00:44,600 I'm here on the material UI documentation page under components inputs and text fields text field is 7 00:00:44,600 --> 00:00:50,510 a very straightforward piece of functionality because all you're doing is allowing your user to enter 8 00:00:50,510 --> 00:00:53,910 some text into your application. 9 00:00:54,000 --> 00:00:58,400 You can see here they have three different main variants. 10 00:00:58,410 --> 00:01:00,190 The standard variant. 11 00:01:00,290 --> 00:01:07,680 He filled a variant in the outlined variant and if we scroll down here below it gives us an example 12 00:01:07,680 --> 00:01:15,390 of some of the props that we can use with the text field component notice up here. 13 00:01:15,390 --> 00:01:21,890 This first one this is marked as required and that is thanks to a required prop here. 14 00:01:22,110 --> 00:01:25,120 It is disabled thanks to a disabled prop. 15 00:01:25,230 --> 00:01:30,750 This is a password field so the text is being hidden like a password. 16 00:01:30,750 --> 00:01:39,060 This box I cannot click in so it's only it's read only I cannot edit the text and this is a number so 17 00:01:39,060 --> 00:01:47,310 I can increment or decrement that but I cannot enter any actual text it's important to note some of 18 00:01:47,310 --> 00:01:54,030 the terminology here because we have the default value which is a value that is giving us an example 19 00:01:54,030 --> 00:02:01,080 of the values that can be put into this text field while this name here house is password and when I 20 00:02:01,080 --> 00:02:03,480 click on it that goes up to the top. 21 00:02:03,600 --> 00:02:05,340 That is our label. 22 00:02:05,340 --> 00:02:11,040 So if we open it up and we show the source for this we can see we're really just using the text field 23 00:02:11,040 --> 00:02:17,250 component and we're setting a label here and that sets that name. 24 00:02:17,280 --> 00:02:24,410 That text here is going up to the top or in this case as required if we get rid of this. 25 00:02:24,630 --> 00:02:27,980 You can see that required does jumped down. 26 00:02:27,990 --> 00:02:30,320 So I think that that is the label there. 27 00:02:30,320 --> 00:02:30,840 Yeah. 28 00:02:30,970 --> 00:02:38,670 Label of required and then the label of disabled so you can see how if we had no text in here this would 29 00:02:38,670 --> 00:02:39,760 be sitting in there. 30 00:02:39,780 --> 00:02:47,280 So this is the label and then the value is the actual text put inside and we can say a default value 31 00:02:47,640 --> 00:02:51,910 and then this text underneath this is our helper text. 32 00:02:52,020 --> 00:02:57,510 So if we scroll down you'll see on some of these we'll find one. 33 00:02:58,410 --> 00:03:05,700 So here help or text some important text on the text field with a default value of default value. 34 00:03:05,700 --> 00:03:12,700 The label of help or text so you can scroll up you'll see and that would be this option right here. 35 00:03:12,780 --> 00:03:21,120 The default value of default value but the label of help or text is the label and the actual help or 36 00:03:21,120 --> 00:03:23,790 text of some important text. 37 00:03:23,810 --> 00:03:33,120 So this right here is the actual help or text set using the helper text prop right. 38 00:03:33,120 --> 00:03:41,860 They're all on just our text field we also always want to provide an I.D. to our text field and to make 39 00:03:41,860 --> 00:03:48,010 sure that it is unique because that will be passed along to some of the underlying input components 40 00:03:48,400 --> 00:03:55,310 and make sure that it is properly set up for some of the accessibility features we can continue down 41 00:03:55,310 --> 00:03:56,030 now. 42 00:03:56,060 --> 00:04:04,130 And here you see an example of how they have validation built into the text field component. 43 00:04:04,130 --> 00:04:11,960 This is thanks to the error prob and you can see if we show the source here that if you set the error 44 00:04:11,990 --> 00:04:19,910 prop of true onto a text field then you automatically get this red styling both for your help or text 45 00:04:20,180 --> 00:04:22,430 the line and the label. 46 00:04:22,490 --> 00:04:28,940 And while they do provide the error prop to us to determine whether or not that is true or false the 47 00:04:28,940 --> 00:04:35,120 actual error handling and setting True or false for that value will be left to us. 48 00:04:35,120 --> 00:04:37,770 So we'll be going over different ways to do that. 49 00:04:37,850 --> 00:04:45,300 They are actually very simple if we can continue it will hide the source and underneath here we have 50 00:04:45,300 --> 00:04:52,530 the multi line input and this is important because remember on our Contact Us page we have that message 51 00:04:52,560 --> 00:04:55,320 input and that is a multi line input. 52 00:04:55,380 --> 00:05:00,330 So this is how we do that and it is simply with a mealtime line. 53 00:05:00,330 --> 00:05:08,840 Prop if we come and open up the source here you'll see the we have a couple different options and so 54 00:05:08,900 --> 00:05:15,560 this first one has a multi line prop of true actually all of these will have the multiplying prop of 55 00:05:15,560 --> 00:05:20,440 true but this also has a rose max of 4 OK. 56 00:05:20,500 --> 00:05:22,520 So this is the first option here. 57 00:05:22,550 --> 00:05:25,930 So this has a maximum number of rows of four. 58 00:05:25,940 --> 00:05:30,060 So if I just start typing random in here you see now are on the second row. 59 00:05:30,200 --> 00:05:32,740 We have a third row of text and we have a fourth row. 60 00:05:32,750 --> 00:05:40,280 But now if I continue you see the scroll bar and we're never gonna have more than four lines of text. 61 00:05:40,280 --> 00:05:42,470 Now all right. 62 00:05:42,540 --> 00:05:43,730 Megan scroll down. 63 00:05:44,150 --> 00:05:45,990 Let's take a look at the second one. 64 00:05:46,040 --> 00:05:49,880 It has multiple line has just a place holder. 65 00:05:50,000 --> 00:05:52,900 But it does not have a maximum number of rows. 66 00:05:52,910 --> 00:05:54,310 So let's see this one. 67 00:05:54,320 --> 00:06:00,710 I think it should just keep growing no matter how much text we put on in here. 68 00:06:00,730 --> 00:06:00,990 Yeah. 69 00:06:01,040 --> 00:06:06,800 You can see that it's just going to keep adding more and more rows as many as we like. 70 00:06:07,010 --> 00:06:17,190 If we do not set the rows Max prop so it will just go infinitely that last example then is when we set 71 00:06:17,430 --> 00:06:19,460 a fixed number of rows. 72 00:06:19,470 --> 00:06:23,800 So here we set a rows a value of four. 73 00:06:23,850 --> 00:06:30,690 And so this guarantees that we always have the large size whereas this we can go and get rid of all 74 00:06:30,690 --> 00:06:34,710 this and it will go down to one up to four. 75 00:06:34,740 --> 00:06:40,380 But this one will always stay at four no matter how much text we have inside of it. 76 00:06:40,740 --> 00:06:45,350 So it'll stay at four but then see we have the scroll bar. 77 00:06:45,360 --> 00:06:52,940 So it continues sitting at four and does not grow let's continue now and I'll come down to hide the 78 00:06:52,940 --> 00:07:02,450 source and you can see here an example of how they can use the select prop to turn the text field into 79 00:07:02,480 --> 00:07:03,310 a dropdown. 80 00:07:03,310 --> 00:07:05,930 This is actually a selection window. 81 00:07:05,930 --> 00:07:09,590 So here you can select different currencies. 82 00:07:09,590 --> 00:07:19,830 And this is actually all done just by setting your text field component with the select prop of true. 83 00:07:20,050 --> 00:07:25,930 You can see this is definitely a versatile component just like the menu and list components that we've 84 00:07:25,930 --> 00:07:31,750 seen before we can go ahead and close out of that source and we'll continue. 85 00:07:31,750 --> 00:07:37,680 And here they give us an example of how you can use icons here on your text fields. 86 00:07:37,810 --> 00:07:45,970 And if we actually keep scrolling this input adornments they say this is the easiest way to add a icon 87 00:07:46,000 --> 00:07:53,800 or a prefix or a suffix to your input and they actually give it an example of how you can use this icon 88 00:07:54,130 --> 00:07:56,320 to create an action. 89 00:07:56,350 --> 00:08:04,390 So this adds a little secondary action where we can hide or view the password all within the text field 90 00:08:04,450 --> 00:08:10,750 material UI component we can open up the source here to take a look at how they do this. 91 00:08:10,890 --> 00:08:18,230 And let's scroll on down and they actually use a different set of components. 92 00:08:18,390 --> 00:08:22,650 So you'll see in here they have this is a good example. 93 00:08:22,680 --> 00:08:25,340 They have the text field component. 94 00:08:25,340 --> 00:08:25,760 OK. 95 00:08:26,160 --> 00:08:29,230 But then they have the input props. 96 00:08:29,310 --> 00:08:36,300 So these are props passed down to the underlying input component within the text field component text 97 00:08:36,300 --> 00:08:40,580 field component is kind of a wrapper on top of a few other components. 98 00:08:40,590 --> 00:08:42,700 That gives us a little more functionality. 99 00:08:42,870 --> 00:08:48,270 And to that input component they're passing the problem start adornment. 100 00:08:48,510 --> 00:08:55,440 And this prop is a component which they are importing the input adornment and components. 101 00:08:55,440 --> 00:09:04,230 So this is a specific component for this purpose passed to the start adornment or end adornment props 102 00:09:04,350 --> 00:09:06,750 on the input component. 103 00:09:06,750 --> 00:09:12,570 So now this is a little convoluted but you just try and think through it see input props and we're passing 104 00:09:12,570 --> 00:09:16,140 down an input adornment in here. 105 00:09:16,230 --> 00:09:24,810 They just have the kilogram but we can see if we scroll down this time we see an end adornment prop 106 00:09:25,170 --> 00:09:30,570 feeding the input adornment component with a position of end. 107 00:09:30,570 --> 00:09:38,220 Previously we had the position of end as well for end adornments but then on our star adornment we had 108 00:09:38,220 --> 00:09:39,800 the position of start. 109 00:09:39,810 --> 00:09:43,820 So that determines where are adornment is appearing. 110 00:09:43,920 --> 00:09:51,360 And here you can see how they set up that visibility icon by checking a value to see whether or not 111 00:09:51,360 --> 00:09:52,980 the password should be shown. 112 00:09:53,070 --> 00:10:01,110 And if that's true then render one version of the icon otherwise render the off version of that icon 113 00:10:02,530 --> 00:10:09,160 so all you really need to keep in mind here we'll go back up to the example that gives it to us on the 114 00:10:09,160 --> 00:10:11,170 text field right here. 115 00:10:11,170 --> 00:10:18,280 So if you have a text field component then you need to just pass the input prop to your text field and 116 00:10:18,370 --> 00:10:27,250 to the input props prop you'll pass an object with these start adornment prop set to the input a dormant 117 00:10:27,310 --> 00:10:30,330 component with whatever adornment you need. 118 00:10:30,460 --> 00:10:34,880 And that is how you are able to create all of these different text fields. 119 00:10:34,900 --> 00:10:38,590 So this has the input adornment at the end. 120 00:10:38,590 --> 00:10:47,890 So a position of end with the end adornment prop whereas these are using the start adornment prop also 121 00:10:47,890 --> 00:10:50,770 with the input adornment component. 122 00:10:50,920 --> 00:10:52,050 But let's scroll down. 123 00:10:52,060 --> 00:10:57,790 I think that that one you've got that and if you need to use icons you can always just come back up 124 00:10:57,790 --> 00:11:01,440 here and and check the source for this and make sure that you have that correct. 125 00:11:01,780 --> 00:11:03,520 But we won't be really needing that. 126 00:11:03,610 --> 00:11:10,240 So we'll come on down and here it gives an example of how you can change some of the layout options 127 00:11:10,270 --> 00:11:17,140 for the text field and the most important in my opinion that we will actually be using is the full width 128 00:11:17,230 --> 00:11:25,450 prop so you can open this up and it is just the prop of full width set to true and that'll just make 129 00:11:25,450 --> 00:11:31,760 sure that your text field is spanning 100 percent of the space available to it. 130 00:11:31,810 --> 00:11:41,390 You can also set the margin prop to either none dense or normal for these different effects here giving 131 00:11:41,390 --> 00:11:49,200 you a bit of different spacing between the elements in your input Becky Bond scrolling down though and 132 00:11:49,200 --> 00:11:55,710 here is saying the component can be controlled or uncontrolled and that simply means whether or not 133 00:11:55,770 --> 00:12:02,490 your value for the text field is coming from a state value or whether the component itself is managing 134 00:12:02,490 --> 00:12:03,520 the value. 135 00:12:03,540 --> 00:12:08,560 So here these text fields are going to be controlled. 136 00:12:08,580 --> 00:12:17,280 So if I go ahead and I start changing one of these values you see that it is controlled by a state value. 137 00:12:17,400 --> 00:12:24,960 And since all of these inputs are controlled by the same state value they all change their values in 138 00:12:24,960 --> 00:12:32,450 real time together however if we were to come to one of these uncontrolled form fields we can type in 139 00:12:32,450 --> 00:12:36,710 anything we want here and none of the other fields are affected. 140 00:12:36,950 --> 00:12:44,630 And that is because they are not controlled by any value except the value from their own component. 141 00:12:44,690 --> 00:12:49,730 There are different times when you might need to use the uncontrolled versus controlled but for our 142 00:12:49,730 --> 00:12:55,430 purposes we'll just be using the controlled version because we need the value to be coming from the 143 00:12:55,430 --> 00:13:02,150 state so that we can then grab that state value which contains the input value and use that later to 144 00:13:02,150 --> 00:13:03,650 send it off in the message. 145 00:13:03,680 --> 00:13:10,550 So we'll need to use the controlled version but we can scroll down and here it tells you that the text 146 00:13:10,550 --> 00:13:17,570 field component is made of all these other components that you can go in and customize however much 147 00:13:17,570 --> 00:13:20,830 you need to get the exact look that you're going for. 148 00:13:20,930 --> 00:13:27,200 And we actually will be going in and doing a bit of customization for our inputs so we'll get a good 149 00:13:27,200 --> 00:13:29,390 idea of how to use this. 150 00:13:29,510 --> 00:13:35,510 And under here it continues to show you the underlying input component. 151 00:13:35,750 --> 00:13:42,050 And then here it shows us the color prop that we can use to change the highlight color. 152 00:13:42,080 --> 00:13:48,230 So there's that highlight color when it's focused but we will be customizing all the colors for our 153 00:13:48,230 --> 00:13:48,800 inputs. 154 00:13:48,800 --> 00:13:51,360 So again I think that will cover all of that. 155 00:13:51,380 --> 00:13:58,670 And here it just gives us even more examples even in an example of a Google Maps looking input all built 156 00:13:58,730 --> 00:14:06,880 with the material UI components that really is everything that we need to know for our text field because 157 00:14:06,880 --> 00:14:13,390 although this is a very diverse component that is obviously very powerful our implementation of it in 158 00:14:13,390 --> 00:14:15,750 this application is relatively simple. 159 00:14:15,760 --> 00:14:18,040 So it shouldn't be too difficult. 160 00:14:18,070 --> 00:14:24,190 I think that the bulk of the work will actually come from styling and customizing the inputs as well 161 00:14:24,220 --> 00:14:28,000 as setting up the validation that will take just a little bit of work. 162 00:14:28,030 --> 00:14:34,840 So let's head over to the next video where we'll get started setting up the contact us page and then 163 00:14:34,840 --> 00:14:36,710 we'll get into wiring all of this up. 164 00:14:36,730 --> 00:14:38,530 So I will see you over there. 17966

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