Layout & Design

Using Layout Templates in Framer (Fundamentals Lesson 22)

Using Layout Templates in Framer (Fundamentals Lesson 22)

Using Layout Templates in Framer (Fundamentals Lesson 22)

Joseph

·

12:22

·

52K views

·

About this lesson

Components and styles make larger projects infinitely more manageable. But even still, when we have tens or even hundreds of pages, the pages themselves can share a lot of repeating structure.

Think things like navigation bars, footers, and even properties of a page itself like width, padding, and background color.

One: it’s a shame to have to repeat the same work every time we create a new page.

And Two: Making a simple change — like switching your navbar to fixed positioning could mean having to tweak page after page after page.

This is where Layout Templates in Framer come in, allowing us to take repeating global elements and properties, and save them as a template.

Which not only makes creating new pages much faster and keeps pages more consistent, but also gives us a central place to make global changes to pages across our entire site.

https://www.youtube.com/watch?v=ew1m1OmrHM4&t=0s Intro

https://www.youtube.com/watch?v=ew1m1OmrHM4&t=11s Why use layout templates in Framer

https://www.youtube.com/watch?v=ew1m1OmrHM4&t=34s How layout templates save time and keep pages consistent

https://www.youtube.com/watch?v=ew1m1OmrHM4&t=76s Creating your first layout template

https://www.youtube.com/watch?v=ew1m1OmrHM4&t=113s Understanding the template canvas and placeholder frame

https://www.youtube.com/watch?v=ew1m1OmrHM4&t=175s Adding a footer to your template

https://www.youtube.com/watch?v=ew1m1OmrHM4&t=210s Applying and managing templates across pages

https://www.youtube.com/watch?v=ew1m1OmrHM4&t=278s Switching, adding, and removing templates

https://www.youtube.com/watch?v=ew1m1OmrHM4&t=326s Managing templates in the assets panel

https://www.youtube.com/watch?v=ew1m1OmrHM4&t=364s Making templates flexible with variables

https://www.youtube.com/watch?v=ew1m1OmrHM4&t=421s Adjusting padding with variables

https://www.youtube.com/watch?v=ew1m1OmrHM4&t=529s Adding a variable for nav style variants

https://www.youtube.com/watch?v=ew1m1OmrHM4&t=591s Using toggle variables for padding

https://www.youtube.com/watch?v=ew1m1OmrHM4&t=710s Wrap up

Benjamin's Layout Templates video: https://www.youtube.com/watch?v=B3_Ps0Oo1pU

🌞 Start for free: https://framer.link/yt

📚 Learn more at: https://framer.link/yt-academy

💎 Join the Community: https://framer.link/yt-community

🎉 Follow on X: https://framer.link/yt-x

0:00components and styles make larger0:02projects infinitely more manageable but0:04even still when we have tens or even0:06hundreds of pages the pages themselves0:08can share a lot of repeating structure0:11think things like navigation bars0:13Footers or even properties of the page0:15itself like wi padding or background0:17color one it's a shame to have to repeat0:20the same work every time we create a new0:22page and two making a simple change like0:25switching your Navar to fixed0:27positioning could mean having to tweak0:29page after page after page this is where0:33layout templates and framer come in0:34allowing us to take repeating Global0:36elements and properties and save them as0:39a template which not only makes creating0:41new pages much faster and keeps Pages0:44more consistent but also gives us a0:46central place to make Global changes to0:49Pages across our entire site let's take0:52a look at how layout templates and0:53framer0:56work before we jump in layout templates0:59have some awesome tricks up their sleeve1:01when it comes to more advanced1:03interactions and animations and we have1:05an awesome video by Benjamin where he1:07digs into that stuff in this video we'll1:10just hit the basics but I'll put a link1:12to Benjamin's video in the description1:14below for when you're ready to get into1:15the crazy stuff let's start by creating1:18our first layout template there are a1:20few different ways to create a layout1:22template but I'll start with the little1:23trick that I use most often I know I1:26want my Navar to be part of my template1:28since I want it on every page of my site1:31so I'll right click on the nav bar1:32itself and choose create layout template1:36I'll give it a name like main layout and1:39before I click create I want to point1:40out that this modal gives us a heads up1:42that this first template will be applied1:44to all pages automatically which is1:47great saves us a step just like1:49components we edit a layout template in1:51a dedicated canvas view let's take a1:54look at the anatomy of this whole thing1:55we have our breakpoint or break points1:58which we'll get into in a later lesson1:59and with my desktop breakpoint selected2:02I can see on the properties panel we2:04have our width set to 1,200 fixed and we2:07have a height that's set to a th000 now2:10the height is automatically going to2:12adapt to the content of each page that2:14our templates applied to so we can2:16largely disregard this we can just2:18increase or decrease the height as we're2:20editing the template if we need more or2:22less space for ourselves here and within2:24our breakpoint we have the nav bar2:26because I right-clicked on it and2:27created this layout template from the2:29Navar which adds it automatically and we2:31have arguably the most important part we2:34have this placeholder frame here and the2:36placeholder frame here represents all of2:39the content that's going to be populated2:41from each page that this template is2:43applied to so right now we're not going2:45to see anything but when we go to our2:47Pages after we're done here we're going2:49to see the content of the pages appear2:51within or in place of this placeholder2:55so let's make sure our layout template2:57has everything that we want to apply to2:59every page we have our navbar I want3:02that on every page we have the content3:04which is going to replace the3:05placeholder and we're just missing our3:07footer but I do have a footer component3:10that I've created so I'll head to the3:12assets panel I will grab the footer and3:14I will drag it here to the bottom to3:16insert it and it might look like the3:18placeholder area got squashed but again3:21this is going to expand or contract to3:23fit the content of the page once the3:26template's applied so let's take a look3:28and see what happened I'm going to head3:29back to the homepage and there is my3:31Navar and now you can see this little3:33dash line around it which reminds me3:35that it's part of the template and not3:36part of this page and in fact when we go3:39look at the layers panel we no longer3:41see the Navar as part of the page3:44content it's no longer here so it's kind3:47of out of sight out of mind it gets3:48inherited from the template that's3:50applied and we can see the template3:52that's applied by selecting the3:53breakpoint itself you'll see the name of3:55it at the top of the properties panel3:58but I do see my footer here and that's4:00because I had the footer included as4:02part of this page content when I applied4:05the template so applying a template to4:07an existing page you may have to clean4:09up some of that duplicated content so4:12I'll just delete the footer since it's4:13getting inherited from the layout4:14template and now you can see that really4:16the only content on this page is the4:19hero section up here and the featur4:22section down here the rest of it is4:24coming directly from that layout4:26template and if I head to my pages we4:28can look at pricing we can look at blog4:30they've all got that navbar and they've4:32all got that footer again our first4:35layout template gets applied to all of4:36our Pages automatically but we can also4:39apply or remove templates on a page by4:41Page basis to choose which layout4:43template is applied we can select the4:45breakpoint and here at the top of the4:47properties panel we see the name of the4:50template that's applied we can click to4:52switch to a different template if we4:53have several of them that we've created4:55or we can hit the minus sign here to4:58disconnect this page from the template5:00and in doing so all the elements that5:02were part of the template will disappear5:05and similarly if you have a page that5:07doesn't have a template applied you can5:08click the plus sign to add a template5:10and you can choose which one you want to5:12have applied from the little drop- down5:14menu here you can also edit a template5:16from here or you can just double click5:18on any element that's part of the layout5:19template on the canvas and it'll bring5:21you back into that dedicated canvas view5:24where we can make edits to the template5:25itself and when it's time to manage our5:28layout templates we head to the same5:29place we manage all of our other assets5:31the assets panel you'll see a list of5:34all of the layout templates in the5:35project at the very top from here you5:37can create new layout templates too by5:39clicking on the plus icon or create5:41folders to organize your templates as5:44you create more and more of them and5:46from the overflow menu for each template5:48you can edit which you can also do by5:50just clicking once on the name rename5:53which you can also do by double clicking5:55on the name duplicate this whole5:57template or delete it you'll of course6:00run into situations where your first6:02layout template doesn't mesh perfectly6:04with the content of a page on this last6:06page of my site the navbar is above the6:09hero area just like it sits above the6:11page content on every other page but on6:13this page I'd really rather the Navar6:16overlap this blue background and be an6:18inverted variant with white text and a6:21white CTA button your first instinct6:24might be to create another layout6:25template for this page and other Pages6:27like it but much like we learned6:29components in the previous lesson we can6:31use variables to make a layout template6:34much more flexible let's try creating6:36some variables to make our first layout6:38template work for this page too so again6:41to edit our layout template I'm just6:42going to double click on the Navar since6:44that's an element that's part of the6:46template and then here we are in the6:48dedicated canvas editing the template6:49itself now if we want the nav bar to be6:52able to overlap the content below it we6:54don't want it to be set to relative6:56otherwise it's going to push everything6:57down so I'm going to switch that from6:59relative7:00to Absolute and similarly if you wanted7:03the nav bar to remain fixed in place you7:04could do fixed instead but I'm just7:06going to do absolute for now and you can7:08now see immediately that the placeholder7:10slid up and the navbar now overlaps it7:13so we're part of the way there but we7:14don't want that to happen on every page7:16on most of our Pages we want the7:19placeholder content to be pushed down by7:2180 pixels because that's how tall our7:23navbar is because we don't want it to7:25accidentally overlap anything it's just7:27that one page that we want to be able to7:29overlap so I'm going to select the break7:32point itself I'm going to break apart7:35our padding into separate values here7:37and I'm going to add that 80 pixels of7:39padding so we're sort of back where we7:41started and then on the Navar itself7:44we've got a fixed pixel width here I'm7:45also going to change that to relative so7:48that it automatically fills 100% of the7:50browser so now we're sort of right back7:53where we started but now we at least7:55have this padding value that we could7:57play with so that we could expand or7:59collapse that extra space at the top but8:02currently this padding exists just8:04within the template itself so this value8:06of 80 is going to be shared across every8:08page that uses this template but8:11templates are a lot like components and8:13if you remember from the previous lesson8:15we can bubble this property up to be8:17editable at the instance level by adding8:19a variable so I can click on the padding8:22here I can choose to create a variable8:24it's automatically going to name it8:25padding it's going to default to 808:27which I want because most of my page are8:29going to need that padding but now I'm8:31going to have a value to edit on the8:33pages that need this to be different on8:35the pages that need that Gap at the top8:37to be zero so that the nav overlaps8:39everything and the other thing that8:41we're going to need to do to avoid the8:43button and text clashing on a dark8:45background is to allow ourselves to8:47switch between two different variants of8:49this nav bar at the page level and8:51you'll find that with this nav bar8:52selected I do have an inverted variant8:55but if I apply that variant here again8:57it's going to change it on every page8:59that uses this template so instead I'll9:01leave it on default because most pages9:03are going to work best with this default9:05appearance but I'm going to add a9:07variable to this variant and variant's9:10not a very descriptive name I'll call it9:13nav style so now I have two variables9:16for myself I have padding that I can9:18adjust on individual pages and I have9:20the nav style that I can adjust on9:21individual pages so let's head back to9:23that page where we want the nav bar to9:25overlap and here see those properties9:28get bubbled up to the page level where I9:30can now say I would like the top padding9:32to be zero and I would like the nav9:35style to be inverted and there we go9:38those properties are overwritten on this9:39page but if we go and look at any of our9:42other Pages they're still set to those9:44default properties since I haven't9:46overridden them here or here or here now9:50another way to go about this just to9:51push things even further is since I know9:54I'm only ever going to want this to be9:5680 or zero I'm not going to want it to9:59be anything in between I'll show you a10:01little trick I'm going to double click10:02my navbar to go back in and edit the10:04layout template here and I'm going to go10:06back to variables and instead of having10:09this padding variable that allows me to10:11type in whatever number I want I'm10:13actually going to get rid of that I'm10:14going to rightclick and remove it I'm10:17instead going to click the plus sign and10:19I'm going to add a toggle variable and10:22this toggle variable just gives me a yes10:24or no question and what I'm going to do10:27is I'm going to name this top padding do10:31I want the top padding yes or no and10:34right now there is no difference between10:36choosing yes or no because it's not10:38connected to any value yet but if I come10:41over here to the padding property and I10:43choose to add a variable rather than10:45creating a new variable I'm going to set10:47an existing variable I'm going to choose10:49my existing top padding variable and10:52what I'm going to do is I'm going to10:54convert that yes or no into 0 pixels or10:5880 pixels so I'm going to choose convert11:02and here I can say when yes let's have11:05that add 80 pixels of top padding11:08because yes we want padding and when no11:12let's have it set to zero pixels of top11:14padding because no we don't want the top11:16padding and that's it now we have a yes11:19or no variable that's going to translate11:21to 80 pixels of top padding or zero11:23pixels of top padding so let's go back11:25to this page and right now top padding11:27is set to yes because that's the default11:29and again that's what makes sense for11:31most of our pages but if I switch it to11:33no no equals zero top padding if I11:35switch it to yes yes equals 80 pixels of11:38top padding so now I don't have to worry11:39about getting any math right I don't11:41have to worry about getting my numbers11:43right remembering how tall the top nav11:45is remembering it's 80 pixels I just11:47have one simple variable for yes or no11:50and there you have it now you know what11:52layout templates are for and how they11:53work under the hood how to create them11:55and apply them to Pages how to edit them11:58and make global changes to potentially12:00tens or even hundreds of pages in just a12:02few clicks and how you can use variables12:05to make your templat super flexible12:08that's it for this one I'll see you in12:10the next one

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.