Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,900 --> 00:00:07,350
Buttons are some of the most common components that you'll use throughout your applications.
2
00:00:07,350 --> 00:00:14,070
They are one of the simplest ways to allow users to interact with your application and usually allow
3
00:00:14,070 --> 00:00:23,710
them to perform actions or to select options they come in all sorts of shapes sizes and colors and thankfully
4
00:00:23,710 --> 00:00:32,280
material UI makes it really intuitive to handle a variety of different cases before we go and start
5
00:00:32,340 --> 00:00:35,350
using the button in our application.
6
00:00:35,370 --> 00:00:39,020
Let's go take a look and see what options they provide for us.
7
00:00:39,030 --> 00:00:41,760
Already all.
8
00:00:41,780 --> 00:00:52,070
And here we are at the material UI documentation page under components inputs and then buttons.
9
00:00:52,190 --> 00:00:56,150
I think the everyone for the most part knows what a button is.
10
00:00:56,150 --> 00:01:00,200
So I'm not going to spend too much more time just going over that you know.
11
00:01:00,290 --> 00:01:06,680
It allows your users to take actions and make choices with a single press but we're really more interested
12
00:01:06,710 --> 00:01:10,490
in what type of buttons material UI has to offer.
13
00:01:11,160 --> 00:01:16,730
You can see here already that they provide a number of different presets.
14
00:01:16,830 --> 00:01:19,230
You can choose from and then customize.
15
00:01:19,240 --> 00:01:26,460
Further if you need to but let's take a look at how all of these buttons are actually working and the
16
00:01:26,460 --> 00:01:30,130
different props that they use to make each one.
17
00:01:30,340 --> 00:01:39,090
You can see these are all contained buttons and they're distinct by using elevation and fill as opposed
18
00:01:39,150 --> 00:01:43,910
to just an outline so you can see all of these at the bottom here.
19
00:01:44,010 --> 00:01:51,690
You can see they are all filled in as well as having a drop shadow except for the disabled button and
20
00:01:51,750 --> 00:01:55,200
these are all called contained buttons.
21
00:01:55,350 --> 00:02:05,350
So that starts with the variant of contained that's going to give us that raised full button look and
22
00:02:05,380 --> 00:02:15,180
then you can change the color based on the material UI theme with primary or secondary if you needed
23
00:02:15,180 --> 00:02:18,700
to use a color besides primary or secondary.
24
00:02:18,840 --> 00:02:27,030
Then you can do so by using a class name and then specifying a background color in these styles object
25
00:02:28,170 --> 00:02:36,360
to create the disabled button you see it just takes the disabled prop so simple enough there and that's
26
00:02:36,360 --> 00:02:39,930
basically all there is to these basic buttons.
27
00:02:39,930 --> 00:02:48,570
There just the button component with the specified variant and then a color if you so choose let's keep
28
00:02:48,570 --> 00:02:56,760
going down and take a look at some of the other buttons like here you see the text buttons and so these
29
00:02:56,760 --> 00:02:58,170
are less pronounced.
30
00:02:58,170 --> 00:03:06,530
You see they don't have a fill or the drop shadow but they are still buttons just the text if you want
31
00:03:06,530 --> 00:03:15,050
to create these text buttons you can see here that we do not specify a variant but actually just use
32
00:03:15,080 --> 00:03:20,430
a basic regular button in place whatever text we would like inside.
33
00:03:21,560 --> 00:03:28,690
That simply renders the text inside as a button that can be pressed to trigger an action.
34
00:03:28,860 --> 00:03:30,090
We'll keep going.
35
00:03:30,090 --> 00:03:33,200
And here you see the outline variety.
36
00:03:33,240 --> 00:03:38,320
So if we go here the variant of outlined.
37
00:03:38,410 --> 00:03:46,330
So this gives us not just the basic text to look like above and not the field in look like the contained
38
00:03:46,390 --> 00:03:56,020
buttons but it gives us the just outlined look and that is just by specifying the variant outlined all
39
00:03:56,020 --> 00:04:02,560
of the rest of the props like color and disabled are all going to work exactly the same no matter which
40
00:04:02,560 --> 00:04:03,860
variant you choose.
41
00:04:05,040 --> 00:04:13,080
You also can make grouped buttons which are styled differently as you see here to show the unity between
42
00:04:13,110 --> 00:04:22,460
a set of actions if you view the source code for the grouped buttons you can see that it uses a button
43
00:04:22,470 --> 00:04:32,170
group component from material UI core to wrap the buttons so just remember that you need the button
44
00:04:32,260 --> 00:04:33,910
group component.
45
00:04:33,910 --> 00:04:41,650
If you want to combine your components into this button group style and below there's a similar option
46
00:04:41,650 --> 00:04:48,100
but instead of having other options it has a dropdown from which you can select another option.
47
00:04:48,130 --> 00:04:52,600
And in this example that changes the action that you can perform.
48
00:04:52,610 --> 00:05:00,290
This is done also using the button group component but this time the two buttons within your button
49
00:05:00,290 --> 00:05:08,750
group is first the actual button that you want to have performed the action say here with the on click
50
00:05:08,750 --> 00:05:17,000
handler and then next to that it has a another button but inside it has the arrow dropdown icon.
51
00:05:17,030 --> 00:05:24,650
So they simply place an icon inside of another button component and wrap both of those buttons with
52
00:05:24,710 --> 00:05:28,260
the button group to give you this dropdown effect.
53
00:05:29,590 --> 00:05:36,340
The other kind of buttons that they have available are floating action buttons and these are buttons
54
00:05:36,340 --> 00:05:40,690
that come in two variants regular and extended.
55
00:05:40,690 --> 00:05:48,130
And this allows you to create a button that always stays on the screen providing quick and convenient
56
00:05:48,130 --> 00:05:57,470
access to a commonly performed action the floating action button is its own component here seen fab
57
00:05:57,720 --> 00:06:05,310
and then you're able to specify the variant of extended or leave it as the default.
58
00:06:05,700 --> 00:06:13,290
The extended variant simply has a text along with the icon whereas the other fabs you simply put an
59
00:06:13,290 --> 00:06:15,400
icon on the inside.
60
00:06:16,550 --> 00:06:24,740
After floating action buttons here they show you the size prop that you can use on any of the buttons
61
00:06:24,740 --> 00:06:32,120
whether it is a floating action button a text button a contained button and outlined button or even
62
00:06:32,120 --> 00:06:34,320
your extended floating action buttons.
63
00:06:34,460 --> 00:06:41,940
You can all use the size property to specify a default width.
64
00:06:41,970 --> 00:06:51,740
You can also change the width to custom sizes by setting the width on these styles object under sizing
65
00:06:52,310 --> 00:06:53,880
go down here.
66
00:06:54,050 --> 00:07:01,450
It shows you can also add your icons to buttons which we will be doing so we'll be going over that.
67
00:07:01,730 --> 00:07:09,260
Or you can just simply have the icons themselves as buttons which are used again for commonly performed
68
00:07:09,260 --> 00:07:12,540
actions similar to the floating action button.
69
00:07:12,620 --> 00:07:19,490
Although the floating action button is fixed on the screen in a certain position and these will just
70
00:07:19,490 --> 00:07:23,300
be used where you actually just need an action performed
71
00:07:27,230 --> 00:07:29,390
you can customize buttons as well.
72
00:07:29,390 --> 00:07:36,080
Of course which I've talked about and we'll be going through and doing that pretty extensively so you'll
73
00:07:36,080 --> 00:07:37,870
see that in just a minute.
74
00:07:37,970 --> 00:07:46,740
And here's an example of some even more complex buttons that material UI is able to create we will actually
75
00:07:46,740 --> 00:07:53,970
be creating some complex buttons for the estimate calculator so you'll also get a look at how that works.
76
00:07:55,030 --> 00:08:02,740
The last part of the documentation for buttons in material UI is an example of how you can use a third
77
00:08:02,740 --> 00:08:11,020
party routing library such as react router to combine your button components from a material UI with
78
00:08:11,020 --> 00:08:19,600
the link component from react router you see here they use the component prop on the button and that
79
00:08:19,600 --> 00:08:27,130
allows them to pass the link and all of its properties and functionality to the button components.
80
00:08:28,330 --> 00:08:35,980
Using the component prop we are then also able to add the two property which would be passed to the
81
00:08:35,980 --> 00:08:43,480
link directly on our button and all of the props that are not used by the button component itself are
82
00:08:43,480 --> 00:08:47,880
passed down to the component that we specify.
83
00:08:47,920 --> 00:08:55,240
This allows us to put our two property with our root for the link right on our button without having
84
00:08:55,240 --> 00:09:02,690
to pass it down explicitly that's another really helpful feature that I like about material UI that
85
00:09:02,690 --> 00:09:09,770
enables some really interesting behavior which you're going to see later on but I will be covering the
86
00:09:09,800 --> 00:09:15,890
complete react router integration so you don't have to worry about this too much as we'll go over that
87
00:09:15,890 --> 00:09:18,080
in detail in a couple videos.
88
00:09:19,100 --> 00:09:26,450
But that really is about it to the buttons in material UI and you see that they provide a pretty dynamic
89
00:09:26,450 --> 00:09:34,010
range of options for you to choose from making it really easy to then build on those default styles
90
00:09:34,190 --> 00:09:37,090
to get the buttons to look exactly how you want.
91
00:09:37,160 --> 00:09:45,250
For any application or design with that under our bill it's obviously time to go and put it to use by
92
00:09:45,250 --> 00:09:48,100
building the estimate button for our header.
10790
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.