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

Is `text` in the "Dynamic code snippets" documentation a typo or a feature?

Open wosephjeber opened this issue 1 year ago • 1 comments

First off, my team is super excited about this tool! From our experimentation so far it's looking really promising as a way to help bridge the gap between designers and engineers.

I'm confused by the text prop in the "Dynamic code snippets" documentation, though:

import figma from '@figma/code-connect'

figma.connect(Button, 'https://...', {
  props: {
    label: figma.string('Text Content'),
    disabled: figma.boolean('Disabled'),
    type: figma.enum('Type', {
      Primary: 'primary',
      Secondary: 'secondary',
    }),
  },
  example: ({ disabled, text, type }) => {
    return (
      <Button disabled={disabled} type={type}>
        {text}
      </Button>
    )
  },
})

That code snippet also shows up in the blog post.

Is this a typo, and the text prop in the example should really be label from the props mapping? Or is there a special text prop that gets passed to the example for all components?

wosephjeber avatar Apr 30 '24 15:04 wosephjeber

That is, indeed, a typo! Either the label prop should be text or the text argument should be label. We'll fix in the next release. Thanks!

ptomas-figma avatar Apr 30 '24 15:04 ptomas-figma