A Figma plugin for inspecting Figma components.
This plugin provides a look at Figma component properties similar to how they are described in code. This plugin does not generate style code. It generates code that describes component properties.
Currently supporting instance and component code generation for:
- React function components
- Angular components
- Vue components (both option and composition APIs)
- Web components
As well as:
- JSON
Would love to hear from you about what works and what doesn't.
Currently, this plugin supports tag-named slots. Add the --SLOT[tagname]
suffix to the name of a text component property in Figma and it will generate a slot for that attribute. For example, if you create a component with a text property named "heading--SLOT[h2]"
, it would generate the following React instance and definition code:
<Component heading={<h2>My slot content</h2>} />
const Component: FC<{
heading: ReactNode;
}> = ({ heading }) => <>{heading}</>;
The tagname will default to span
if you use the suffix --SLOT
without a tagname.
If your Figma component has a single text property, it will be treated as a generic slot.
This can be configured by running the Component Inspector > Configuration command.
If you have a boolean Figma component property that controls visibility of a text or instance swap property (or one of their ancestors), that boolean property will be ignored in generated code and the text or instance swap property will disappear when the boolean is false.
If you have a variant option property that defaults to the string "undefined"
, that property will be treated as truly optional (no default).
If you have an instance swap property that defaults to a component named "undefined"
, that property will be treated as truly optional (no default).
This can be configured by running the Component Inspector > Configuration command.
You can configure the component inspector to ignore properties named with a provided prefix.
This can be configured by running the Component Inspector > Configuration command.
If your variant options are all numeric or if the default value for a text property is numeric, the generated code will treat it like a number type property.