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

Can I combine string and children values and map them to one property?

Open alisonjoseph opened this issue 1 year ago • 4 comments

titleItem: figma.nestedProps('_Contained list title item', {
  label: figma.boolean('Tooltip', {
    true: figma.string('List title text') + figma.children('Tooltip'), <--how can I do this?
    false: figma.string('List title text'),
  }),
}),

alisonjoseph avatar Jul 08 '24 17:07 alisonjoseph

In this stage of code-connect (v 1.0.6) it is not possible. but we can get same results with variant restriction.

see this -> https://github.com/figma/code-connect/issues/80#issuecomment-2200476356

Chanki-Min avatar Sep 04 '24 06:09 Chanki-Min

@Chanki-Min I'm not sure variant restrictions would help me here since its a nested prop, unless I missed something and variant restrictions support nesting.

alisonjoseph avatar Sep 04 '24 13:09 alisonjoseph

+1

@Chanki-Min In my case, there are multiple nested components that I want to display based on specific boolean conditions. I'd like this feature to be supported.

accentButton: figma.boolean('accentButton', {
  true: figma.nestedProps('Button', {
    variant: figma.enum('variant', {
      normal: 'normal',
      outlined: 'outlined',
    }),
  }) + figma.nestedProps('ButtonContent', {
    label: figma.string('label'),
  }), // Please support this case.
  false: {
    variant: undefined,
    label: undefined,
  },
}),

higuchimmy avatar Sep 18 '24 06:09 higuchimmy

Any updates on this 👀

alisonjoseph avatar Sep 17 '25 14:09 alisonjoseph