Layout & Design

Intro to Components in Framer (Fundamentals Lesson 21)

Intro to Components in Framer (Fundamentals Lesson 21)

Intro to Components in Framer (Fundamentals Lesson 21)

Joseph

·

16:57

·

68K views

·

About this lesson

Components are the building blocks of scalable and efficient design in Framer.

Whether we’re creating buttons, nav bars, cards, or footers, components allow us to design once and reuse elements across our projects.

Using components, we can speed up our workflow, maintain perfect consistency, and make global changes to elements across our entire project, or multiple projects, in just a few clicks.

In this lesson, we’ll explore how to create, customize, and manage components in Framer. And how to make components super flexible with variants and variables.

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

https://www.youtube.com/watch?v=7LdaBIcgqzw&t=6s Why components are essential in Framer

https://www.youtube.com/watch?v=7LdaBIcgqzw&t=39s Creating your first component

https://www.youtube.com/watch?v=7LdaBIcgqzw&t=73s Inserting components from the assets panel

https://www.youtube.com/watch?v=7LdaBIcgqzw&t=119s Using quick actions to insert or replace components

https://www.youtube.com/watch?v=7LdaBIcgqzw&t=173s Detaching and replacing component instances

https://www.youtube.com/watch?v=7LdaBIcgqzw&t=213s Editing components and creating states and variants

https://www.youtube.com/watch?v=7LdaBIcgqzw&t=288s Adding an inverted variant

https://www.youtube.com/watch?v=7LdaBIcgqzw&t=352s Using component variants in the design

https://www.youtube.com/watch?v=7LdaBIcgqzw&t=391s Making text editable with variables

https://www.youtube.com/watch?v=7LdaBIcgqzw&t=473s Editing variables from component instances

https://www.youtube.com/watch?v=7LdaBIcgqzw&t=516s Nesting components within other components

https://www.youtube.com/watch?v=7LdaBIcgqzw&t=556s Creating a pricing card component

https://www.youtube.com/watch?v=7LdaBIcgqzw&t=658s Making pricing card variants editable

https://www.youtube.com/watch?v=7LdaBIcgqzw&t=752s Adding variables for bullet points and visibility

https://www.youtube.com/watch?v=7LdaBIcgqzw&t=836s Replacing cards with component instances

https://www.youtube.com/watch?v=7LdaBIcgqzw&t=868s Managing components in the assets panel

https://www.youtube.com/watch?v=7LdaBIcgqzw&t=925s Sharing components across projects

https://www.youtube.com/watch?v=7LdaBIcgqzw&t=985s Wrap up

🌞 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 are the building blocks of0:02scalable and efficient designs in framer0:05whether we're creating buttons nav bars0:08cards or Footers components allow us to0:10design once and reuse elements across0:13our projects using components we can0:15speed up our workflow maintain perfect0:18consistency and make Global changes to0:20elements across our entire project or0:22multiple projects in just a few clicks0:25in this lesson we'll explore how to0:27create customize and manage components0:30in framer and how to make components0:32super flexible with variants and0:35variables let's jump0:39in before we create our first component0:42let's look at what we're working with to0:44figure out what makes sense to turn into0:46a component in the first place in my0:48example project here you can see I have0:50a few of these nearly identical buttons0:54so this is definitely an element that0:56should probably be a component Now to0:58turn one of these into component and it1:00really doesn't matter which one since1:02they're all virtually identical we just1:03want to select the element we just have1:05to have a single element selected on the1:07canvas and we can either rightclick and1:10choose create component or use the1:12keyboard shortcut which on a Mac is1:14option command K and on a PC would be1:18Control Alt K when we click on that we1:20get to give our component a name and it1:22automatically takes on the name of the1:24layer from the layer list so in this1:25case this layer is called buttons SL1:28primary CTA and just like like our color1:30styles and our text Styles buttons slash1:33is going to create a folder called1:34buttons and it's going to create within1:36that primary CTA so I'm going to run1:39with this and I'm going to click create1:42we're automatically brought into this1:44dedicated canvas view for our new1:45component but before we dig into this1:48let's go back to our homepage and talk1:50about inserting instances of a component1:52where they belong now you'll notice this1:55element here since it's the element that1:57I created the component from1:59automatically gets turned into an2:00instance of this component which I could2:03copy and paste elsewhere like over here2:05where these buttons are that I want to2:07replace with this component or I can2:08head to the assets panel and on the2:11assets panel you'll find all of the2:13components within your project so here I2:14have that buttons folder because the way2:16I named this and I have primary CTA and2:19I can just click and drag this directly2:21onto the canvas and then I can delete2:24this button so that I just have the2:26component there replacing it now the2:29size of this button does get inherited2:31from the component itself but I can2:33change that so I'm going to change the2:34width here from fit content to fill and2:38there we go another way to insert a2:40component that will save us a step is if2:42I press command K to bring up my quick2:44actions menu or control K on a PC I can2:47type the name of this button so CTA and2:51here it is in my quick actions menu now2:54when I hit return to select it I have a2:56few options I can insert this button I2:58can edit this button or I can replace3:01what I have selected on the canvas with3:03this button so by choosing that in one3:05step I've replaced that button that was3:07not a component with my component and3:10you'll notice instead of inheriting the3:12size from the component it inherited the3:14size from the layer that I replaced so I3:16really just saved myself a few steps if3:18you decide you don't want something to3:20be a component anymore you can always3:21rightclick it and choose detach instance3:25and you can also replace this component3:27with another component or replace all3:29instances of this component with another3:31component which can be a huge timesaver3:33we can also jump in and edit a component3:35directly from any instance of it by3:38either double clicking or selecting and3:41pressing return on the keyboard and3:43you'll also find an edit component3:44button on the properties panel now we're3:47back in that dedicated canvas View for3:49the component where we can make edits3:51and create additional variants any3:53changes we make here within this view3:55will affect every instance of this3:57component and while we don't necessarily3:59need to make any changes to this default4:01state of this button we might as well go4:03ahead and create some states and4:05variants that make this component more4:07flexible you'll notice that built into4:09the canvas itself we have the option to4:11create a hover or press state for this4:13button and we also have the option of4:15creating a whole different variant of4:17this button and variants are super4:19powerful because you can start linking4:21them together and you can create very4:23Dynamic interactions within a component4:26we're going to save that for another4:27course but for now I'm going to create a4:29hover state for this and when you create4:32a hover State this way it's4:33automatically going to set up the4:34interaction that switches variants when4:37the cursor hovers over it so that part's4:39already done for us but for my hover4:41variant here I'm just going to give it a4:43different fill color and I'm just going4:45to swap it with this content 50 so that4:48button will get a little lighter on4:50Hover the next thing I want to do while4:52we're here we are going to need an4:55inverted version of this button we had a4:57black card in the middle that's going to4:58need a white version of this button so5:00to do that I'm going to click here to5:02add a variant and for this variant I'm5:05going to change the fill color to my5:08content inverted and I'm going to select5:10that text layer and I'm going to change5:12the text color to content 1005:15effectively reversing the foreground and5:17background of this button it'll also be5:19helpful later if I name these variants5:21correctly so I'm just going to press5:22command R which would be controlr on a5:25PC and I'm going to name this5:27inverted and then my primary variant I5:30could leave it alone or I could change5:32the name to default and for good measure5:35let's also add a hover state for our5:37inverted version of this button and for5:40this I'm just going to be lazy and do5:42the same thing I'm going to change it5:44from white to that middle gray and I'm5:46going to change the text from black to5:49content inverted which is white and5:52there we have that so now I can go back5:53to the homepage I can find this version5:56of the button which before would have5:58been a problem to replace with our5:59component because it would be black on6:01black but I'm going to do just that I'm6:02going to do my little trick where I hit6:04command k i do a search for our CTA6:07button here I select it and I choose6:10replace and of course because the6:12default variant is black now we've got6:14black on black but because I have a6:15second variant that I've created for6:17myself I can come over here to the6:18properties panel and switch the variant6:20from default to inverted and boom there6:23we go now we've got another little6:26problem starting to emerge where every6:28instance of this button matching6:29perfectly isn't necessarily a good thing6:32those buttons that we replaced in these6:34cards had different text content before6:37but you'll notice if I try to change the6:39text content here this entire component6:41instance is like one object so I can't6:44click my way in there if I double click6:45we go into edit mode for that component6:47and if I make a change here it's going6:50to affect every instance of this button6:52so this is where variables come in if I6:55want to make the text content of this6:57button editable at the component in6:59instance level I can select this text7:01layer I can head down to Content and7:04you'll notice a lot of the properties on7:05the properties panel have this little7:06plus sign next to them and that is a7:08mechanism to create a variable from this7:11property so from the content property7:13I'm going to click I'm going to choose7:14create variable it's going to be plain7:17text and when I do so the variables7:19model appears and it gives me a chance7:21to give this variable a name it's a good7:23idea to name your variables because it7:25will be confusing later when you go to7:27edit them you may not know what they7:29mean but in this case title does make7:32sense we could also name it button text7:35something like that and the text that7:37was written there before is going to7:38become the default text but this is now7:41going to be editable because it's now a7:43variable so let's look at how this7:45actually shows up one we see purple over7:49here on the properties panel showing7:50that this property is now driven by a7:53variable so if we want to edit what we7:55see here within the component we're7:57going to do so from our variables model7:59which we can get to from the toolbar at8:01the top of the screen but the more8:03important thing is we can go back to8:05these instances and get for free doesn't8:09really apply to these two because these8:11two are paid so if I select either one8:14of these two instances now on the8:16properties panel we have a new property8:18for that variable that we just created8:20and there's the name of it I named it8:21button text and here is the value get8:23for free is there by default but I can8:25change this to sign up now and I could8:29do the same8:29for this other one here sign up now8:32there we go that's more like it and we8:34can do that for all kinds of properties8:35we can make the color editable we can8:37make the corner radius editable we could8:39even make the padding editable whatever8:41we got to do to make this component as8:43flexible as it needs to be you can also8:46Nest components within one another8:48either by inserting a component as a8:50child of an existing component or what8:52I'm about to do here which is create a8:54component from this card that already8:56has a button component inside of it in8:59fact all of these cards could really be9:01one component this inverted one could be9:03an inverted variant just like we did9:05with our button so to turn all these9:07into the same component I'm going to9:09start with the biggest one because it's9:10easier to hide extra bullet points than9:13it is to add them in and I'm going to9:15turn this into a component so I'll9:17rightclick I'll choose create component9:20and pricing card that's a fine name I'm9:22going to click create now one thing's9:24for sure I'm going to need an inverted9:26variant of this so I'm immediately going9:28to create a new variant I'm going to9:30make sure I select the parent frame9:32where that white fill is applied I'm9:34going to change that to my content 1009:37and then I've got a few layers here that9:39are black now that need to be inverted9:42as well so here I'm just going to9:44override the color of this style turn9:47that into content inverted I've got a9:49bunch of text layers in here I'm going9:51to drag to select but I want to select9:54only the child layers here so I'm going9:55to hold the option or ALT key and that's9:58only going to select what fits entirely10:01within my bounding box that I'm dragging10:03so that allows me to just kind of lasso10:06those child layers and then with those10:08selected I'm going to edit the text10:11color here and then I'm going to do the10:13same for the icons that sort of10:15disappeared here I'm going to hold the10:16alter option key and it's only going to10:19select them when they fit completely10:21within my bounding box see I don't grab10:23those text layers on accident because10:25they don't fit completely until I get10:27all the way out here with my bounding10:28box so so it allows me to be a bit10:31surgical with my selection and with10:33these selected I'm going to switch these10:35to content inverted as well and last but10:39not least our button just like we did on10:41the main design canvas I can just switch10:44that from the default variant to the10:46inverted variant and boom now I've got10:48two variants of my card and I'll do the10:51same thing here where I rename this one10:53inverted and I'm going to come over here10:56and rename this one default perfect but10:59in this case there are quite a few11:01layers that are going to have to change11:04or be changeable at the instance level11:06we've got the name the price the button11:09text and all of the bullet points down11:11here all the features to make these11:13editable at the instance level we just11:15do the same thing that we did for the11:17button so with this text layer selected11:19I'm going to come down here and I'm11:20going to create a variable for the11:22content of this text box I'll choose11:25plain text and I'm going to name it plan11:28name because that's what this text box11:30represents the name of a plan that you11:32can choose from and I'm going to do the11:34same thing for the price with the price11:35selected I'm going to come down here11:38content create variable plain text and11:41this one is going to be called price11:42which is already there so that's great11:44I'm going to click away and next we've11:47got this button here and the button11:49already has that variable set up within11:51it that allows me to override the text11:53but that variable currently is only11:55accessible when I select an instance of11:58that button so if I'm selecting an12:00instance of the entire card I don't get12:03access to that variable but what I can12:05do is bubble it up one level by adding a12:07variable within the card so we've got a12:10variable talking to another variable we12:12can do that and that's an important12:14thing when we're nesting one component12:16within another and button text is a12:18perfect name now there are a couple of12:20things that I want to do here I want to12:23allow the text to be changeable for each12:25and every one of these bullet points so12:27that the features can differ from plan12:29to plan so I would do the same thing12:31there as we've been doing and I'm not12:33going to make you watch me do that over12:34and over again but I'd want the content12:37to have its own variable for bullet12:39point one bullet point two bullet point12:413 bullet point 4 Etc and I also want to12:45be able to turn off probably feature12:48five and feature six because our middle12:52card only had five features and our12:54first card only had four features so we12:57can add a variable for the visibility of12:59feature five and feature six so with13:01feature five selected I'm going to come13:03down here and for visibility I'm going13:05to add a variable create it and I'm13:09going to be a bit more explicit with the13:10name here not just visible but visible13:13feature 5 so that way later I'll know13:16which one I'm toggling the visibility of13:18and then feature six I'm going to do the13:20same thing I'm going to create a13:22variable for the visibility and visible13:25feature13:27six cool so now when I go back I have a13:30couple of options I could either replace13:33these two cards with this component that13:35I just created like I did with the13:36buttons or I can delete the cards and13:39then I can duplicate this component a13:41couple of times select the middle one13:44and switch out the variant to inverted13:47there we go and then for this one I can13:49also say feature six visibility no and13:53for this first one I could say feature13:55five and six visibility no so I get13:58access to the layer visibility I get14:00access to the properties within the14:02component from the outside of the14:05component because I've turned them into14:06variables just like we did with that14:08button and then of course I have the14:10text variables that I added like this14:12plan here which will say free and the14:15price we can say $0 a month and then the14:17rest the features and all that good14:19stuff I didn't add those variables I14:21don't want you to have to sit here and14:22watch me do that but you can add those14:23variables for any and every text layer14:26that you might need to change at the14:27instance level14:29when it's time to manage our components14:31we can head back to the assets panel and14:34here we get a little plus icon where we14:35can actually create a new component14:38without even having anything selected we14:39can create an empty component and start14:41to build within that or once we have a14:44bunch of components created we can start14:46to organize them in new folders and we14:48can also sort alphabetically when we14:50have more and more components built up14:52here as far as managing components14:55themselves we've got a little overflow14:57menu here and we can click to insert a14:59component just one more way to insert a15:01component we can also edit from here or15:03you can just click the name of the15:04component to edit it you can find15:06instances of this component much the15:08same way we found layers that were using15:11Tex Styles and color styles in a15:12previous lesson and we can also rename15:15duplicate and delete the next few things15:18on this menu are all about sharing15:20components with other projects either in15:23your own workspace or virtually anywhere15:25else to make a component accessible15:28across all of your projects you can come15:30down here to library and you can add15:33this component to your workspace library15:35and that will allow you to go into any15:37other project in your workspace hit the15:39shortcut command forward slash or15:41control forward slash on a PC and search15:43for any component you've added to your15:45workspace library and those instances15:48will remain linked to the project where15:50you created the component you can unlink15:53them or you can detach them completely15:55but if they remain linked and you make15:57any changes to the main component it15:59will allow you to pull that update into16:02any instance in any other document in16:04your entire workspace and copy URL16:07allows you to copy a link to a component16:09and paste it into another project or16:12even share it with someone else to use16:14in their projects in fact the framer16:17Community is full of talented designers16:19and developers sharing components16:20they've made that you can drop into your16:23own sites with just a couple of clicks16:25and there you have it now you know what16:27components are all about about how to16:30create and insert them how to edit them16:32and create variants how to create16:34variables to make component instances16:36much more flexible and how to manage and16:39share components with other projects and16:41even other people that's it for this one16:44I'll see you in the 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.