I have this code component "ColorComponent" that acts as a swatch:
import * as React from "react";
export function ColorComponent({className,color}:{className:string,color:string}) {
return <div className={className} style={{height:"24px",width:"24px",backgroundColor:color}}> </div>
}
I’d like to change the color prop value as it maps through the data, in the same way I do with tokenName, textValue and description, within the parent component DesignTokenItem.
Do I use “Link to a prop for component DesignTokenItem”
And select add “color”?
Also, how do I removed “ColorSwatch” and “colorSwatch” after accidentally creating them as props.
For a complete picture.: ChakraDoc.tsx component imports the DesignTokenItem.tsx component which imports the PlasmicDesignTokenItem.tsx (which is synced).
OK. Set to Color with default value #FF00FF. But see no color, not even the default color on my list of colors.
If I change colorSwatch2 to color in PlasmicDesignToken.tsx, then I see red appear for all colors.
(Not sure what this code is, why its set to colorSwatch2 and not color)
As ultimately, one day, I’d love this all to be registered tokens that are editable in Plasmic back to the original json. But I think this would require another Style dictionary transform to work with Theo.
args.color is correct (it is passing the color prop that it receives into the color prop for ColorComponent). Can you print and see what props are being passed into your ColorComponent?