Hi everyone. In this video we're gonna make this tiny little button, but look what happens when we click it, it dropped down. And look, we hover above stuff and look at this. Ready? Mind blown. There's a double dropout menu.
Some might call a sub menu multi-level menu. And when we click on stuff, we get a page two exhilarating. Now if you've done the last video where we looked at a different way of making a dropdown menu, we end up in the same place. But we use a different method to get there. And it's important to learn both. It's both good practice for us learning here in the advanced course, but it's handy when we are using other people's work.
They might have gone about creating dropdown menus in different ways. And if we know both, we'll be able to easily update it or make our own. Now, in the last video I said that this method was a little harder than the last one. I'm not sure it is. I think I've got better at explaining it in the second version so it seems about the same up to you, which one you use. Alright, let's jump in.
What I like before, I've got a components page and I've got two pages that we can kind of jump between. Uh, I'm gonna start with a type tool Tiki. I'm gonna make a filter button with join on text, lower it down. I am going to escape on my keyboard to select the whole thing. Shift A to make it an auto layout. I'm gonna style it a little bit.
You wait there. Okay, so I've got a button. It's an actually button yet. It's just an auto frame. I'm gonna have an another one before I make it a component 'cause I want 'em to be separate components. This one here is gonna be my menu item because they're gonna have different amount of text in them.
I want them to be a specific size, okay? Not the text. I don't wanna change the text to fixed width. I wanna use the parent. Just shift enter. Okay?
And I want you to go fix width and I'm gonna be one 60 left. The line is fine. Alright, so I want these both to be separate components. So create multiple components. Let's name them right? Command R, control R.
It's gonna be my button filter. This one here is going to be my button menu item. All right, so here's the big thing. We are going to make an, we're gonna leave this, okay? These are our main components. We're gonna use instances of these from here on.
Okay? So you guys are helpful, but you can kind of go away. Okay? So I want this, it's an instance of button filter. I wanna stick it inside of another component, okay? It's, give it a better name.
It's gonna be called drop down. Whoop, drop down. I can spell, oh I can't, there we go. Drop down menu. This one's gonna do majority of the work. We want two variations, okay?
And this one here is going to have some of this going on. So again, I don't want the main component in here. I want the instance of this. I'm gonna make an instance holding down member option key on a Mac, old can a pc. Then I'm gonna drag it in here, okay? And where's it gonna go?
It really didn't want to go inside of my dropdown menu. There it is there. So you can just drag it and and try and get it in there. Okay? I want it inside a variant too. That's really what I wanted.
And let's name these. Okay, I'm gonna do it over here 'cause that's why I prefer, okay, this is going to be drop down, oh man, typing today. Okay. And I've got tab, I got two variants. I'm gonna have closed and tab again open and I'm gonna change the layer. Order for no good reason other than closed is on the top and I feel like open should be on the bottom.
Okay, inside of open, I've got two options. Now these two instances of these two guys at the top here are wrapped up in this parent here, parent frame, which happens to be an auto layout. This is up to you whether you wanna keep it in auto layout 'cause it might be helpful. Let's say this vertical layout is actually quite useful and at the moment they're the wrong way around. So I'm gonna click on filter and go you're at the top. And then these I can go command D, D, D or control D, DD.
The parent shift enter. Okay? Doesn't have to be an auto layout. You can go minus and it will still work. You just can. And now you can manually move them to where you want it to be.
I'm leave mine as the auto layout 'cause it's kind of helpful. So I'm done. Alright, now we just need the interaction. So this top one here is shift E. Okay, I'm gonna see you go to the when clicked change to the dropdown of open and filter button here. When you are clicked, go back that way.
Go back to closed. Let's give it a test. So what I'm gonna do is I'm gonna drag an instance, not of that, not of that. These guys go down here, you are the boss, you're doing all the work. Okay? You on an instance of this?
Okay, let's preview it. Will it work? I don't know. I think it should. Page one. If I click on this, Hey it works.
Here we go. So there's our dropdown menu. I'm actually thinking which way is harder now is it the overview way or this way may do it. We're learning both of them. 'cause you'll find both of them online. No right or wrong.
I'm sure there's about 10 other waves. Let's fancy it up a little bit with R Hover. So this one here is a main component. I want two variants. I want the second variant shift E to go down to fill, click on HS, B that I like using this last one, hold shift head down to darken it up a little bit. So I've got two, one dark, one light.
Let's name them. Let's click on the parent. Let's click on the variance and let's call this uh, state. And we've got default and hover and we're gonna go to prototype mode and say you when you are on hovering change to hover and you go back to this unclick, change to default. Nice. It should work without any other hassle.
There we go. Nice. Now this is where it gets confusing. We need a second option. Okay? So we need that kind of extra dropdown.
If you just need that, your job is done. Okay? Obviously we need to go through and say you actually over here, this one here, open design. Let's go from close to open and say when you are clicked prototype mode, I'm gonna just gonna say add another interaction other than hover. When clicked go to navigate to page two. 'cause they're already on page one.
Let's give it a test. You page. Are they both called page one? They are both called page one. There you go. You're like that didn't work Dan.
It's 'cause I called them both page one. Now let's give it a go using my left arrow to go back. Ah, for refresh, which didn't refresh it much at all. This first option should go to page two. Here we go. Nice.
What I might wanna do is by default close that down now copy it. Face it over here. Alright, we're gonna style the buttons. Change the writing over here. Okay, instead of saying menu item, you could have the different pages or categories. Let's change mine.
All right, there are my ones. There we go. Okay, next thing I wanna do is add that second level. So what we want to do is we basically wanna recreate this kind of contraption here. We'll reuse these 'cause these menu items, you could have a second set of these, but they do what we want it to do. Basically we need to recreate this.
Okay? So we need a first button, okay? Not a instance of it. We need to break it apart. It's command option B, control alt B. Okay, there's rename it so we don't get too confused.
Let's call this one other. Let's change the text in it to say other. You can see over here in the layers panel, I'm just tabbing through. You can kind of tab through the menus, which is handy. Remember that didn't change it at all. Other, there we go.
The label and the text. Okay, so we've got this, it's an auto layout. Let's make it a component so we can control it. And now we need to do the same thing as we did before. Let's duplicate this. So we've got an instance of it.
We don't need that anymore. That's just my overall controller. This instance though can be inside of a component. We do that 'cause we want two variants of it. This variant here is not gonna change a whole lot except we're gonna do the same thing as this. I want one of these menu items.
You could create another set of menu items if they needed to be functionally different. But I'm gonna create an instance of this one, okay? Not a new component, just another instance. 'cause I want to use these on all of them. I'm gonna put it inside of here and it won't go inside. It's ended up hanging out here, not inside of it.
So let's have a look at naming first. So with this selected, I am going to go property. This one's going to be secondary dropdown. I'm going to have two. I'm gonna have closed and tab open to make a little bit more sense. So I want this, which is not in anything to be inside secondary.
Where is it there? So it's inside my component that I made. Okay, that I called other. I actually didn't call it, it just got it off that original name. So let's rename this. Okay?
Menu button. I want it to be inside the open option. I want it to be the other way around. So you're on top this, I want to be command D. I went the wrong way. It's in is an auto layout so I can't move it.
So sometimes the auto layout doesn't suit us. So I'm gonna select the parent shift enter. Okay, grab that whole group. And I don't need it to be an auto layout 'cause I wanna do a cross and then down. Okay? It's not like just one flow.
Line it up. Drag out a few more options. However many you need. You can shift select them all and say, oh look, some of them ended up way out here. You get in there. Actually they need to be in with his buddies there.
That's probably what's gonna cause you the most problem is that you are doing things and dragging them and duplicating them and they ended up outside of where they need to be. Either outside of the component set like it did at the beginning or it's gonna end up outside of the variant open. They're all in there now. It's got some weird sizing going on. Remember command option, shift all the keys plus R and that's Ctrl alt shift R to kind of wrap it around at least. And that's gonna wreck it as soon as we select all of these.
And remember quick keys, let's use pack vertically. Now it's the wrong size. All right, we got on a fin, a bit of a tangent there. Basically what we've done is remade this. We took an instance of this button. There it is there.
We made two variants of it. The second variant here, we grabbed a bunch of the menu items and we threw it in. We just make sure it's inside of the variant that we named open. And now let's test it works without connecting it up to that first one. So what I wanna do is, remember this is the boss. These two guys were helpful for controlling the style of the buttons, but the mechanics are happening with these two groups here.
Okay, so you, I want an instance of you. Let's put you over here. Let's see if you work. There we go. Refresh. It's not working.
You know why it's not working. 'cause we didn't actually add any interactivity. So in my prototype you go to there on click change to open. And this button here, I don't wanna do it to the whole group when it's clicked 'cause I want these menu items to go somewhere else. But when this other other button is clicked, go back to this first option. Let's give that a go.
Yep. Okay, it works. Now we need to tie it in with this. So what we need to do is we need to go over here to my first list. Okay? And this menu item here, we need to switch out.
I could grab this copy, go to this one and go paste and replace command option shift v, control alt shift V. Wonder why I made it too small. That's okay, we'll fix that in a second. But now that will trigger this group. This guy will trigger his another group I think let's give it a go. You not you filter.
Go down to other and there's my menus. Look at that. What I might do is just make the original one 60. That's why we've got this. So we're gonna give you and not hug your fixed. And you are one 60.
What are you broken up here? You fit, you fit. Maybe these need to maybe just move over a little bit as well. And hopefully over here. I don't need that one. I just need to preview this one.
Boop, boop, boop. Here we go. Look at us. Now you can spend some time going through and saying, actually when this one is clicked in prototype mode, where does it go? It's going to go to click and go to page, wherever it needs to go. To navigate to this other page that I've made.
All right, page one, filter, other menu item page two, look at us. Alright, so how's your head uh, wrecked after a bit of dropdown menus. Um, if you do find it like a bit tricky, often what people will do is they won't actually build an interactive dropdown menu. It'll just be something that looks like it. So I'm gonna drag this out and kind of break it apart and they'll just um, do this. They'll show this plus this.
And then they might have another menu just destroying my design copy paste. Let's get you guys outta there. And they'll just do this To show a dropdown menu. 'cause the developer building it, we'll be using JavaScript probably to build your menu and they just need to see the visuals for it. Okay? And your stakeholders might just need to see what one of your menus looks like.
Drop down. Okay? You might have these other buttons and you're just showing how, for instance, this is how this works. And that's it. There's no components, no instances, no swaps, no variance. They just show this version.
But, but it is really good to show in those kind of prototypes, an interactive version rather than just a static one. Alright, that is it for the other way to make dropdown menus. A lot of similar components, but a different implementation. No right or wrong. And you will find stuff in the community that uses either version and it's good to know how they're made so that you might be able to use somebody else's work and make it work in your own. Alright, that's it.
I'll see you in the next video.