Загрузка видео...

Не удалось загрузить видео

На главную

Swap variant instances between modes in Figma using boolean variables. 🤔 Doing it right, or missing something?

34,184 просмотров • 3 лет назад •via X (Twitter)

Комментарии: 16

Фото профиля Johan Netzler
Johan Netzler3 лет назад

@figma Here’s another way of solving this. Maybe ✌️

Фото профиля MDS
MDS3 лет назад

@figma Whoa, didn’t realize you could use string variables like that. Thanks!

Фото профиля Catherine
Catherine3 лет назад

@figma From my understanding, it is not possible at the moment… The variable can be linked to a value within an instance, but not directly inside a component… Here is a test within a frame :

Фото профиля Kish
Kish3 лет назад

@figma Set the mode on the section when the instance is inside the section and not the shape

Фото профиля MDS
MDS3 лет назад

@figma Ah yeah, I think I set the mode before I created the boolean variable. Seems like it should work even if one came before the other.

Фото профиля Maxim Leyzerovich
Maxim Leyzerovich3 лет назад

@figma this is the true power

Фото профиля Alex Yakir
Alex Yakir3 лет назад

@figma I love that. If you make a Shape variable numeric with light mode value 0 and dark mode value 100, and then apply this variable to the corner radius, will the shape trigger as you want?

Фото профиля MDS
MDS3 лет назад

@figma Yeah that would probably work in this scenario, but I'm trying specifically to get the instance swap to work for an actual design I'm working on.

Фото профиля Alex Yakir
Alex Yakir3 лет назад

@figma Oh I see! Try it here, it's triggering without manually setting auto mode:

Фото профиля Alex Yakir
Alex Yakir3 лет назад

@figma plus it follows your design pattern

Фото профиля Mihai Marcu
Mihai Marcu3 лет назад

@figma @mds you need to use in the boolean of the variant true and false this will result in the boolean variable to work correctly. I won't work with on/off or yes/no.

Фото профиля Vikas Raj Yadav ˎˊ˗
Vikas Raj Yadav ˎˊ˗3 лет назад

@figma This is cool.

Фото профиля Ankit Ruhela
Ankit Ruhela3 лет назад

@figma Round corner variables I think is what you need there. I may be wrong, just starting to play around with it.

Фото профиля MDS
MDS3 лет назад

@figma I’m trying to specifically nail down instance swap for a bigger cause in an actual project.

Фото профиля Ankit Ruhela
Ankit Ruhela3 лет назад

@figma Instead of using a Boolean variable for Shape, try using Number variable for Radius. Set radius to 0 for light mode and 200 for dark mode. Then, where you change border radius, the little variable hexagon will popup when you hover, assign that to Radius variable. 🙌🏼

Фото профиля Ankit Ruhela
Ankit Ruhela3 лет назад

@figma Here’s a quick demo, hope it helps

Похожие видео