Layout & Design, Navigation

Make A Responsive Navigation With Dropdown Menus From Scratch

Make A Responsive Navigation With Dropdown Menus From Scratch

Make A Responsive Navigation With Dropdown Menus From Scratch

Benjamin

·

19:49

·

63K views

·

About this lesson

Learn how to create a responsive navigation with dropdowns in Framer—completely from scratch. This uses the recently-introduced Relative Overlay feature: watch the announcement video to learn more about how those work. You can find and freely remix the final demo here: https://nav.supply/ alongside more navigation demos.

https://www.youtube.com/watch?v=QtjU4V_o8eg&t=0s - Introduction

https://www.youtube.com/watch?v=QtjU4V_o8eg&t=26s - Adding Text Layers

https://www.youtube.com/watch?v=QtjU4V_o8eg&t=50s - Grouping with Stacks

https://www.youtube.com/watch?v=QtjU4V_o8eg&t=73s - Designing a Trigger with a Caret

https://www.youtube.com/watch?v=QtjU4V_o8eg&t=113s - Creating a Trigger Component

https://www.youtube.com/watch?v=QtjU4V_o8eg&t=163s - Adding our first Dropdown

https://www.youtube.com/watch?v=QtjU4V_o8eg&t=276s - Creating a Navigation Component

https://www.youtube.com/watch?v=QtjU4V_o8eg&t=290s - Creating a Navigation Phone Variant

https://www.youtube.com/watch?v=QtjU4V_o8eg&t=318s - Editing our Navigation Phone Variant

https://www.youtube.com/watch?v=QtjU4V_o8eg&t=436s - Making Links reusable

https://www.youtube.com/watch?v=QtjU4V_o8eg&t=549s - Adding Links to the Phone Variant

https://www.youtube.com/watch?v=QtjU4V_o8eg&t=605s - Fixing Links and Styling on Phone

https://www.youtube.com/watch?v=QtjU4V_o8eg&t=694s - Adding a Second Dropdown

https://www.youtube.com/watch?v=QtjU4V_o8eg&t=904s - Adding Links to the Resources Dropdown

https://www.youtube.com/watch?v=QtjU4V_o8eg&t=930s - Designing the Expanding Interaction

https://www.youtube.com/watch?v=QtjU4V_o8eg&t=1081s - Finalizing the Link Sorting

https://www.youtube.com/watch?v=QtjU4V_o8eg&t=1131s - Removing the Border from the Expanded State

https://www.youtube.com/watch?v=QtjU4V_o8eg&t=1146s - We did it!

🌞 Try Framer for free: https://framer.com

🎉 Follow on Twitter: https://twitter.com/framer

💎 Join Community: https://www.framer.community

0:00yo my name is Benjamin and in this video0:04I'll show you how to create a responsive0:06navigation with drop downs completely0:09from0:10scratch so this is our starting setup we0:14have a navigation stack and all it0:17currently contains is a stack with an0:20icon and the title I'll select the0:23navigation and I'll hit T and I'll start0:26typing right here to add our first text0:30text layer onto this stack then I'll0:32select a Tex stle that I pre-made to get0:35the styling Just Right Next I'll hit0:39command D to duplicate this item a few0:42times and I'll change the content in the0:44process so this yields us a few0:48different Navigation items I'll hold0:50shift and select all of these in one go0:55and I'll right click to add a new stack0:58then I'll set width to fill1:00height to fit content and distribute to1:04end and I'll also set the Gap to 251:08pixels so now we have our basic setup in1:11place I'll jump to the asset panel and1:14I'll drag in a carrot this is a very1:18simple component that I1:20prepared it's a single graphic wrapped1:24in a frame and that frame is rotated in1:28the second variant1:30so let's go back and group these I'll1:33select both right click and I'll select1:37add stack and then I'll right click1:39again and hit fit1:42content now we can add some padding to1:45the top and bottom as well and there we1:49go I'll decrease the Gap a little bit1:53and then we can turn this into a1:56[Music]1:58component so I'll hit command K select2:01create component and you can give this2:04any name you'd like so let's zoom in a2:08little bit and let's add a second2:12variant I'll name the first one default2:16and the second one open and on this2:19second one I'll set opacity to2:220.5 and I'll change the variant of the2:26carrot and for the text I just had it2:29selected and and hit five on my keyboard2:32which is a nice little shortcut to2:34quickly set opacity so that's it for the2:37triggers of our drop downs and we can2:40always customize the label here as well2:43next let's add our first drop down so2:47I'll select our component2:49instance and then I'll open up the2:52insert menu and I'll head over to the2:55new menus category and I'll grab one of2:58these ones3:00and I'll drag and drop it right onto the3:03component we just made and this is a3:06nice little shortcut to quickly add it3:09as a relative overlay here we can tweak3:12the appear effect and even the spring3:20transition and let's set height to fit3:24content3:26again and I think all of these settings3:28look good3:32so we can now select the trigger and set3:34on open to the open3:37variant and if we give that a3:41preview that should mostly do the trick3:44I see I get a little text cursor here on3:47Hover and we don't have any links just3:50yet to fix the cursor I'll add a user3:54Select Property that is set to none to3:58the component4:00and let's also add some links to the4:04menu here I'll just link them all to4:07framer4:09dcom and I'll make sure they have one of4:12the link styles that I had already set4:14up in this project this also ensures4:18they get a nice little hover state which4:20you can easily Define within your link4:23Styles all right so we have our first4:26drop down in place but as you can see4:30this setup doesn't scale down to a phone4:32break point at all so let's go ahead and4:36fix that first let's select our4:38navigation and turn this into a4:41component here we can create a4:44navigation variant that we can also then4:47use on the phone breakpoint I'll create4:51a second variant I'll call it phone and4:54I'll set width to 390 which is the4:57default phone breakpoint width in5:00framer then let's go back and actually5:03set this variant to the phone variant5:06and let's also set height to fit content5:09here knowing that we'll be able to5:11create a menu that expands and collapses5:16and thus changes in height so let's go5:19back into the component here and5:21actually design the basics of our phone5:25layout I'll resize the height I'll flip5:30the direction of the phone stack itself5:34and I'll do the same for the stack5:37containing all of our links setting5:39distribute to start as well now we5:43really need a menu icon that can close5:46and expand our5:48menu so let's go to the assets panel and5:51drag in the menu icon this is one that I5:55have prepared but it's super simple it's5:58just two Fram frames that get rotated in6:02the second6:03variant so I can drag this into the6:07primary6:09one and then we really need to group it6:12with our little logo here so I'll select6:18both wrap them in a6:20stack and then I'll hit fit content6:24again and then we can set visible to no6:27on the desktop version6:30as we don't need this icon on desktop so6:34let's name this layer the top layer just6:37to make it a bit easier for us to6:39understand this one we want to set width6:42to6:43fill we can now bring back our menu icon6:47and we can set distribution to space6:51between to stretch it6:53out we can then also set padding to zero6:57on the phone variant and add 20 pixels7:01of additional left padding on this top7:05layer I'll set this one to 64 pixels7:09just to ensure the height matches with7:11the desktop height7:15perfectly and now things are starting to7:18come together we do still have a little7:21bit of a problem in our7:24setup and that is that on desktop we7:26have this trigger with a drop- Down menu7:30but on mobile it doesn't really make7:32sense to reuse this same trigger as7:35there is no such hover interaction but7:38we would like to reuse the links so we7:41don't have to define those twice or edit7:44them into two separate places later on7:47so with the drop- down menu selected7:51I'll turn that entire layer into a7:54component and we should make sure we7:56give it an appropriate name so we can7:58recognize it later on and here we can8:02also Define a default variant and design8:05a version to be used in our phone8:08breakpoint or in our phone variant8:11within the navigation component so I'll8:14change the fill color to match remove8:18the radius I'll remove the Border let's8:21also remove these icons and add a sub8:24label here I'll quickly use an existing8:28text St for8:31this now I'll delete the8:37icons and let's make sure that these are8:40a bit taller as they're designed for8:44mobile and then let's tweak the Gap and8:47padding here as8:50well and finally I can add a bottom8:54border to the topmost links8:57here and and there we go that's starting9:00to look like a proper mobile list so9:04let's go back to the9:07navigation our drop- down menu now is a9:11component the one we just9:14created but we also have our trigger9:17with its drop- down menu on phone so9:20let's delete it from there and then9:22let's just also drag in the links9:26directly onto the canvas here this9:29doesn't do anything for the actual9:32navigation but it's very useful for9:34ourselves to quickly jump back into with9:38I will duplicate this instance9:41here and then switch to the phone9:45variant and this one we can actually add9:48to our list of links set width to fill9:53and there we go instead of showing these9:56links on Hover like we have on desktop10:00these same links are now directly10:02visible within the phone10:05menu let me quickly rename this stack to10:13links and we can add a bit of padding to10:16the left and right sides here and tweak10:19the Gap not all of our links have drop10:23downs so any inline link we can now also10:26update just to match the styling on on10:29the phone variant10:31here so I'll select all of these holding10:35shift and then let's set width to fill10:39height to 5610:41pixels I'll set the phone variant to10:48fit and then let's go back and set the10:51vertical align to Middle here as10:54well there we go I'll add some padding10:58to the bottom of our phone variant here11:01this is useful when dealing with11:03viewport height on mobile to account for11:06things like the dynamic address bar next11:10I'll hit F to draw a new frame and we11:13can turn these into little separator11:15lines with width set to fill height to11:18one and fill to a dark gray color next11:22we can drag them onto our links stack11:25give them a name and then I'll duplicate11:28it a few times11:29and I'll move it down each time to11:31separate our inline links now this is11:35starting to look like something but we11:37really only have one drop down let's add11:40a second drop down for our resources as11:44well I'll head over to the assets panel11:48right click on our links and I'll hit11:51duplicate and I'll rename it to11:54resources11:56here so now we have a second compon11:59component with all of the same12:01Styles I can update the subtitle and12:05then I can change the links here so we12:09can add a few different ones like blog12:11careers maybe12:14docs then back in our navigation12:17component we can drag it from the assets12:20panel onto the canvas here just to make12:24sure we don't forget about it and can12:27access it quickly12:29and we could even add more links right12:32they don't have to be three this is why12:34we often have height set to Auto or fit12:38content so I'll add two new items this12:41one I'll call12:43tutorials and I'll grab this one and12:45I'll call this one templates now I see12:49that the order got a little messed up on12:51our phone variant because of what I just12:54did so we can manually change the12:56Sorting to match here13:00and then I miss a bottom order so I can13:04rightclick copy style and then I can go13:07to the docks item right click and hit13:11paste13:12style we could have also right clicked13:15on the phone variant and selected reset13:18order overrides this just does it for13:21you automatically matching the order of13:23the primary variant so let's move the13:27sublabel back on top we're all good on13:30the order here so let's go back to our13:35navigation and we can delete the old13:38resources label duplicate our product13:42item with a drop- down rename the title13:46to13:47resources and then we can go over to its13:51drop- down menu and replace it with our13:55resources links and this keeps all of13:59the relative overlay settings intact14:01like it's positioning and the appear14:04effects so we have our drop- down menu14:07in place on desktop let's also make sure14:10we can reuse these links on the phone14:13variant we no longer need this separator14:17because resources is now a drop- down14:20and not an inline link so let's delete14:22it and head over to the assets panel and14:25bring in our resources links14:29let's switch it to the phone variant14:32I'll again set the width to14:35fill and there we go here we actually14:39have an additional bottom border that we14:42no longer14:44need and that is looking more like it so14:48let's go to the homepage and give this a14:52preview to see what we have so14:57far so we have two little drop downs15:01here and on resources we actually kind15:04of broke our links so let's go back into15:08that component and I'll quickly add a15:11link to framer dcom for each navigation15:14item and we only have to add these links15:18onto the primary variant the phone15:21variant will inherit these15:24changes and there we go now we have15:27links in our resources drop down as well15:31our phone breakpoint is still broken15:33though we only have this expanded state15:36to which it's now set by default so it's15:39time to work on our expanding and15:41collapsing15:43interactions for this we'll need two15:45variants so I'll select the phone15:48variant and create an additional one15:51based off of it let's call that one the15:54phone open15:56variant I'll quickly sort my layers16:00here and let's update the menu icon16:04States and then I'll select our top16:07stack and I'll drag a new interaction16:10link from it to the phone open variant16:14and vice16:18versa so now we can tap on our little16:22header here to switch between these two16:26variants next I'll select the the links16:29stack and set the opacity to16:33zero and then we'll select the phone16:36variant itself and we can actually16:38remove the Gap value from both of these16:42I don't think we need it but mostly we16:45want to set height to16:4764 and remove the bottom padding and16:50also set overflow to Hidden so now we16:54have a proper collapsed State the16:57expanded State however we want to make17:00sure always occupies the entirety of the17:03viewport but never exceeds it because17:05then we can make sure that it becomes17:07scrollable so I've set both Max and Min17:11height to 100 VH next I'll set overflow17:16to scroll and I'll add an over scroll17:18property as well which is set to contain17:21by default this makes sure that when17:24there are enough navigation items you17:27can scroll the navigation and it doesn't17:29scroll the page behind it so now we have17:32all the building blocks in place we have17:35these reusable link components that are17:39used as relative overlays or drop- down17:41menus on our desktop17:46variant these links can be edited and17:49customized and they'll be updated across17:52all your break points as these same17:55links are used on the phone variant17:59and are just surfaced in line now that18:02would have been a lovely ending to this18:04video but I just noticed that the18:07developer's item is still in the wrong18:09place it should really be below18:11resources and not below product so let's18:15go ahead and fix that because we're18:18animating between these two states we18:20always want to make sure that the order18:23matches exactly otherwise we'd get18:26unwanted animations between these two18:29layers so all we need to do here is move18:32the developer item and its separator one18:35layer down which I can do using the18:38arrow down keys and then I'll do the18:41same thing in the phone18:44variant so now the orders should match18:48again and the developer item is below18:51resources one final tip is that you18:54might want to remove the Border here on18:56the phone open variant18:59so it will fade out as the menu expands19:02and you're not stuck with a bottom19:03Border in its expanded state if we19:07preview this you can see our mobile19:10navigation is working and animating19:13nicely and our drop- down menus are also19:17working on desktop plus our navigation19:20is responsive as it switches to the19:23phone variant on the phone19:26breakpoint and that's pretty much it for19:29this video thank you so much for19:32watching I hope it was helpful and stay19:35tuned for more videos coming19:47soon

Watch on YouTube ↗

More in this topic

8 Framer shortcuts you're probably sleeping on4:19
8 Framer shortcuts you're probably sleeping on
Layout & Design3K views · 2 months ago
Framer Update: Stack Sorting and Bento Grids2:16
Framer Update: Stack Sorting and Bento Grids
Framer Update7K views · 2 months ago
Sharing Vector Sets Across Projects (Vectors Lesson 7)3:41
Sharing Vector Sets Across Projects (Vectors Lesson 7)
Layout & Design1K views · 3 months ago
Connecting Vector Sets to the Framer CMS (Vectors Lesson 6)3:38
Connecting Vector Sets to the Framer CMS (Vectors Lesson 6)
Layout & Design2K views · 3 months ago
Animating Vectors in Framer (Vectors Lesson 5)4:25
Animating Vectors in Framer (Vectors Lesson 5)
Layout & Design4K views · 3 months ago
Customizing Vectors with Variables in Framer (Vectors Lesson 4)4:59
Customizing Vectors with Variables in Framer (Vectors Lesson 4)
Layout & Design3K views · 3 months ago
Replace component instances site-wide in Framer1:39
Replace component instances site-wide in Framer
Layout & Design4K views · 4 months ago
Creating and Organizing Vector Sets in Framer (Vectors Lesson 3)6:58
Creating and Organizing Vector Sets in Framer (Vectors Lesson 3)
Layout & Design3K views · 4 months ago

Create a free website with Framer, the website builder loved by startups, designers and agencies.