figma-plugin icon indicating copy to clipboard operation
figma-plugin copied to clipboard

Nesting in Composition tokens

Open esthercheran opened this issue 2 years ago • 2 comments

Currently composition tokens can be applied to a single layer. It would be great if a composition token could define tokens for nested layers and apply tokens to child/sibling layers as well. For example: A composition token button with the following nesting: Button container

  • border radius
  • fill
  • padding Button label
  • typography
  • fill Button icon
  • size
  • fill

esthercheran avatar Aug 23 '22 09:08 esthercheran

What's the primary use case to solve here? I feel this might be overly complex to achieve.

One thing I could see working is to have something like for CSS, where defining a color attribute will define any text-color property down the line? But do be able to define specific layers sound complex?

six7 avatar Aug 23 '22 21:08 six7

Well actually it sounds complex but from a css point of view it would make sense. You would have a container with a specific color and padding. And nested layers/auto-lay outs within that container would all have the same font. In the current scenario i would all have to select the different text layers and assign a typo token. While with nested tokens i should only have to assign that once. Inheritance could be great but keep in mind that maybe you have overlapping tokens.

https://www.w3schools.com/cssref/css_inherit.asp

bewarai avatar Aug 24 '22 12:08 bewarai

@esthercheran can you shape this more? i'm not sure this is ready yet.

six7 avatar Nov 18 '22 21:11 six7

Added to Featurebase Request- 🪙 ➕ Support multiple tokens per layer of the same type

SamIam4Hyma avatar May 07 '24 21:05 SamIam4Hyma