Hi everyone, in this video we're going to look at... something called Component Properties... it is a really underwhelming name... for something that is spectacularly good... when we're getting into complex components... and is a really good way for an alternative for variants...
just a quick overview... this one here is kind of what we've been doing traditionally... in Figma, and what we've been doing in this course, we just make a button... and we've got three instances of it... this one here does the exact same thing... "But Dan, it's missing all these extra bits"...
ah, but that is what the component properties does. In this case there are a few different component properties... we're going to look at the one called Instant Swap... and to quickly demo what it does, I've got two buttons... the old way, I go through and pick the badly named variants... or the new way, the yellow button...
and the yellow button over here has a lovely little thing, saying Icon... which icon do you want? You want the Done, you want the Plus, want the Pencil... just pick from it... it's easier for the person using the button... somebody in my team, me, in the future...
but it's real power is here... where I don't have to create all these components, it's just one... I switch out this instance using one of the component properties... and if you're like, "Hey, that doesn't seem like a whole lot of work"... it's when variants turn into something like this. Check out the fields here, look at all the different variants you need...
in a field, using Google's Material... so many options that we could cut down to... something that looks and works a lot more like this... all right, let's jump in, and I'll show you how to put one together. To get started, on my Components page I made a Buttons section... and I drew something that looks like a button...
it is just an auto layout at the moment... move the background color, and some text in it... now we're going to show you the bad way because I feel like it's the only way... to really appreciate and understand the new fancy way... it's the way I needed it in my head, anyway. So let's take our Auto Layout, let's convert it into a component...
I'm going to have variants of this component, three of them... I'm going to add some instances... that's why this thing is called an Instant Swap... and will only work when you do something like this, so 'Shift I'... I'm going to find, what have we got, is there a tick in there? Nope, there's a Done, there it is...
so I'm going to drag in this, there we go... it doesn't quite fit, 'Resize to Fit'... so I'm going to have an instance of the Tick... and I'm going to have an instance of, let's go "icon"... and just have an instance of the 'Pencil' in there, and 'Shift I'... let's go for the 'Plus' icon.
So you need these instances in here for this thing to work... so this is the kind of the wrong way of doing it, right, or not the wrong way... it's just the way we've been doing it from now... so we've made this thing called Button A, great... and for me I had to kind of make three versions of it, not a big drama... where it becomes a big drama is when you have to do something...
that's more than three instances... I found this one, check out this... that is our Main component, and these are all the instances, oh my goodness... it's probably the most complex one I could find... this is Google Material's drop down input fields. So this feels really easy, but obviously it can get a lot more complex...
on the other side the person who's using this... goes to their Component library that you've shared with them... opens this out, and goes, "All right, Dan... there's Button A, there's different properties that he hasn't named"... but there's Variant 1, 2, and 3... so that's not a big drama, but watch this, gets better.
So I'm going to make a duplicate, I'm going to detach it... Fill color, any old color... so this is nothing to do with this now, these are all separate... what I do now is, we're going to make it a component... like before, let's rename it, and call it "Button B"... and what we're going to do is, instead of making variants...
what we're going to say is, because there's an instance here, which is our Tick... we can say, I would like you to add a-- so over here... Done's come from the name of my icon... but I want to add an instant swap, it's this thing here... it knows it's an instance, so you don't select on the outside button... you click on the instance inside of my component you say, actually, I'd like you to do an instant swap, please...
and the instance name is going to be "Icon". So people that are going to be using this... I'm thinking ahead to the person using this now, saying... okay, there's going to be an option, says Icon... and they're going to be able to add some preferred... this is where this gets really good, you can say...
it has done, but I also want them to be able to pick 'Multiply'... which I need to rename to "Close"... 'Add', let's add the 'Pencil', but I don't want the Bookmark or the Delete. There's just no reason to have it for this particular button, or any buttons... it's used for something completely else, let's click 'Create Property'... and the nice thing is, that thing that I made...
looks kind of nice and clean... let's bring in my, 'Shift I', let's type in "Button" again, let's drag this out... so I'm the user using it now... I say, "All right, I need a button, Dan made this sweet button," here you go... what options do I have? Over here you get this new stuff, this wasn't there before...
but now I've got this instant swap, this is Done... and they can pick from these, only the three... if you've ever worked with a document with like, say a hundred icons on it... there's a huge list here, whereas here, I can just pick the preferred ones... me, as the creator can say, "Actually, I can only use these three"... and they can go and swap them.
I really want to convey how awesome this is... I guess we're going to have to do another couple of videos... where we make something more complex... I think it's the only way but let's just quickly recap. So for me as the creator, mine looks a whole lot tidier, right... and you might be getting stuff now where you're like...
"Where are the variants, how are these hidden, from other people's work?" So I've got my Main component selected... over here I've got this Component property... that has got this, there's this little diamond here, it's an instant swap... you can have more than one Component property... we'll cover them all in a minute... but you can say in here, actually, the person needs that...
you know, they need something else, they need to go... the default, needs to be, let's say the Plus... and also, for the Preferred ones... people are using the Delete, you're like, "You can't use Delete, stop using Delete." What they really need is, they need to be able to add... a bookmark for this button as an option... so for me I didn't have to go and make another variant...
switch them around, auto layout them out, it's nice and tidy... and for the user, when they're using this button here... this is the one they've dragged out... all they need to do is go in here and say, "Hey, what am I allowed to use?" All the preferred options... and if they're like... "Hey, I really need that trash can one, I don't care what Dan says"...
the default is preferred, but actually they can get to all of the components... whether you've got a library shared to you, or local components... now I can go and find my icons... and dig in, and grab every single one I want... so I can override it, but it just makes things tidy about... like what you can and can't use...
for me, as the creator... and the user just gets a nice little drop down to pick from stuff... all right, that is Component properties for an instant swap, super cool... all right, let's look at the next one in the next video.