code-connect
code-connect copied to clipboard
Unable to negate figma.boolean
figma cli version: 1.3.1
example
figma.connect("<DS_LIST_ROW>", {
props: {
removeChevron: figma.boolean("Chevron") === false,
},
variant: { Type: 'Chevron' },
example: ({ removeChevron }) =>
html`
<ds-list-row>
<ds-list-row-chevron
slot="template"
remove-chevron=${removeChevron}
>
</ds-list-row-chevron>
</ds-list-row> `,
});
output
<ds-list-row
>
<ds-list-row-chevron
slot="template"
heading="Label"
remove-chevron="figma.boolean(\"Chevron\") === false"
>
</ds-list-row-chevron>
</ds-list-row>
also tried
figma.connect("<DS_LIST_ROW>", {
props: {
removeChevron: !figma.boolean("Chevron"),
},
variant: { Type: 'Chevron' },
example: ({ removeChevron }) =>
html`
<ds-list-row>
<ds-list-row-chevron
slot="template"
remove-chevron=${removeChevron}
>
</ds-list-row-chevron>
</ds-list-row> `,
});
output
<ds-list-row
>
<ds-list-row-chevron
slot="template"
heading="Label"
remove-chevron="!figma.boolean(\"Chevron\")"
>
</ds-list-row-chevron>
</ds-list-row>
expected output
<ds-list-row>
<ds-list-row-chevron
slot="template"
remove-chevron
>
</ds-list-row-chevron>
</ds-list-row>
Is this the correct usage? Or is there a way to negate the boolean?
We have a few similar cases in our project. There is the option to map booleans to different types/values:
props: {
hideIcon: figma.boolean('Icon', {
false: true,
true: false,
}),
}
It reads a bit funny but should lead to your expected snippet output. ☺
We have a few similar cases in our project. There is the option to map booleans to different types/values:
props: { hideIcon: figma.boolean('Icon', { false: true, true: false, }), } It reads a bit funny but should lead to your expected snippet output. ☺
Perfect thanks! Yeah, that doesn't seem very intuitive.