This plugin is built with Create Figma Plugin.
This is a figma plugin intended to export text and color styles in a format compatible with Material UI.
It seeks to bridge the gap between product design in figma and application in code with MUI by directly transfering styles from between them.
The plugin functions by opening a gui panel with options for generating and distributing typescript code objects with the necessary styling.
This includes color pallete objects as well as style and style type objets.
The primary object for accessible use in code is figmaTypography
which contains text styling attributes including font options and spacing.
The other typography based objects ensure type checking on styling and conformity with CSSProperties
as well as dictating typography to be included in MUI variants.
figmaPalette
holds the coloring properties exported from the figma doc in rgba format along with their associated label.
- Node.js – v14
- Figma desktop app
To build the plugin:
$ npm run build
This will generate a manifest.json
file and a build/
directory containing the JavaScript bundle(s) for the plugin.
To watch for code changes and rebuild the plugin automatically:
$ npm run watch
- In the Figma desktop app, open a Figma document.
- Search for and run
Import plugin from manifest…
via the Quick Actions search bar. - Select the
manifest.json
file that was generated by thebuild
script.
Use console.log
statements to inspect values in your code.
To open the developer console, search for and run Open Console
via the Quick Actions search bar.
Official docs and code samples from Figma: