Hi everyone, welcome to the most boringly named video in the whole course... "How to Preserve Text Overrides", or not, in Figma variants... that catchy tune is because, I don't know, I want to make these videos searchable... and you'll be able to find them, hard to know what to name them sometimes... and sometimes they end up being stinker titles like that... but is it worth your time watching?
Totally is... I'm going to show you the two options. By default what happens in Figma is, if I change this text... this is an instance with a variable, there's two of them... one, two, a big and a small title... but they actually have different amount of characters they can use...
by default what happens is, if I go and change this kind of Premium listing...| that's allowed more characters... and I go and switch it to this other variable... the text persists, comes along for the ride... that's the default, normally that's what you want, but not in this one... I want the user of my component here to know that...| there's a certain amount of characters... I don't want it to kind of automatically switch out...
that's what this one's going to do... I can change the text here, in the Premium one... but if I switch it to the other variant... can you see, the text for that variant comes along... and overrides what I wrote there originally... that's what you want most of the time, just continues on...
but there are times where you need the text...| to kind of switch in between the variants... let me show you how to do that. All right, the default action for instances is probably the right one... and by right one I mean this, I'm going to drag out an instance... and if I change the text in here to "Sign Up"... and then I go and change to one of these other variables...
even though this variable says Primary Button... my text change is persistent... so I'm going to go over here and say, 'State' to 'Hover'... it used the background color, and maybe the size as well... but the text is persistent... that text override I made continues along, but there are times where you don't...
so I'm going to jump down to my other page. So what I've got here is, I've got two event listings... and we can pick between a premium one and a regular event... you just get less characters, and not as big a font there... and I imagine it'll be pushed to the top... and to cut to the chase, I'll do it properly...
but to cut to the chase, basically, if I have this one called Message... and this one here called Message... because they're the same, when I turn them into variants... Figma assumes that, "Ah, they're interchangeable"... they're just called Message... if you name them something differently, it will override each other...
let's do it just in case that wasn't clear. I'm going to select this one, I'm going to stick it into a frame... 'Command Option G', 'Ctrl Alt G', same with this one... select both of them, and let's turn it into a 'Component Set'... up until now we've been making a component and adding a variable... we just did it a different way to mix it up.
So let's see how it works by default, the wrong way... I'm going to hold down my 'Option' key, drag out an instance... so the person using this can go through and say, "All right, I'm going to... 'Add my fancy listing'"... spelled it right... and they can go and pick-- actually, let's pick a different variable...
can you see, it changes, but the listing event is still there... and if they put in a really long one, like they can do in the Premium... they're going to run out of characters, it's going to break my layout... so how do I get it so that it changes to the text listed in this other one? As a reminder, and to give everybody a kind of a character count to work to... all we need to do is we need to say, this in here 'Command' click, 'Ctrl' click...
it says Message, let's 'Command R', 'Ctrl R' to rename it... let's go "Message", this is our "Premium" one... this one here is going to be... a "Regular"... cool, now let's reset this... 'Reset all changes'...
let's switch it to our 'Premium' version, now somebody goes through... they change it and they're like... "Oh great, I'm going to use this again for something else"... I'm going to go, say I'm going to use the smaller version... ah, look, the text gets switched back to this event listings... and it's basically down to the layer names being different, that's it.
Now this could be working against you somewhere, and you're like... "Why does it keep switching?"... you can go back and just rename these in the Component Set... find the variable, and just make sure that and that have the exact same name. So that is the end of the best named video in this course... How to preserve text overrides...
or not, in Figma variables, useful... I try to make these title kind of like searchable... so you can go into, and search in the course, figure out where they are... man, that is a really unsexy title, but useful... all right, that is it, I will see you in the next video.