code-connect icon indicating copy to clipboard operation
code-connect copied to clipboard

Is it possible to connect with layout properties?

Open Tiberriver256 opened this issue 1 year ago • 4 comments

Hello,

Is it possible to connect with layout properties? If so, is it also possible to get variable names?

image

Tiberriver256 avatar Oct 25 '24 12:10 Tiberriver256

Hey @Tiberriver256, this isn't currently possible. It would be interesting to know a bit more about your use case, i.e. what do you want to access and why is it not a component prop? We're definitely interested to support as many use cases as possible.

tomduncalf-figma avatar Oct 25 '24 12:10 tomduncalf-figma

Thanks @tomduncalf-figma!

Our designer uses layout properties and consistent variables quite a bit. We have props laid out on our React components that match the design variables similar to how React Spectrum uses styles and would like to map those values to his.

So for this screenshot: image

I would want to see a code connect snippet that looked something like:

<MyComponent 
    padding-top="3"
    padding-right="5"
    padding-bottom="3"
    padding-left="5"
    radius="m" />

The idea being that we could copy the code-snippet from figma and it would look identical to the design.

Tiberriver256 avatar Oct 25 '24 12:10 Tiberriver256

@tomduncalf-figma we have a similar need. For example, there's a divider component which has an "orientation" property in code that can be "horizontal" or "vertical". But we don't want to add this as a property in Figma because that would double the number of variants. So designers just rotate the divider or transpose its dimensions. It would be convenient to have access to the rotation/width/height attributes to calculate the orientation.

sheila-semrush avatar May 02 '25 15:05 sheila-semrush

We have a similar use case, but for Style properties actually. We have a ColorIcon component that can be any color, and designers just set the fill color directly on Style for this.

adbutterfield avatar Oct 06 '25 03:10 adbutterfield