Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sync] Create Figma plugin to generate a theme.js file #10

Open
3 tasks
oliviertassinari opened this issue Oct 16, 2021 · 28 comments
Open
3 tasks

[sync] Create Figma plugin to generate a theme.js file #10

oliviertassinari opened this issue Oct 16, 2021 · 28 comments
Labels
figma new feature New feature or request scope: sync Issues related to the Material UI Sync Figma plugin

Comments

@oliviertassinari
Copy link
Member

oliviertassinari commented Oct 16, 2021

Introduction

We could create a Figma plugin to sync the configuration with a theme.js file.

Capture_d’écran_2020-09-02_à_23 25 03

https://www.figma.com/community/plugin/797015796747379907/theme-ui

A first prototype was done at https://github.com/mui/hackathon-figma-plugin.

Motivation

This could allow us to make the current Figma file free for the community while selling a subscription (to keep sustaining the effort). The subscription would be for using this plugin and growing into a more advanced suite of plugins to reduce the gaps between code and design.

Benchmarks

Requests

Features

  • Allow to export the theme form Figma
  • Allow to import the theme into Figma
  • Connect the input/output with a theme builder web UI (simple mode)
@oliviertassinari
Copy link
Member Author

oliviertassinari commented Nov 4, 2021

What @danilo-leal found https://material.io/blog/designtocode is pretty cool! It echos back to how we had identified a few months ago (April 2021 with https://www.overlay-tech.com/) as the next steps after solving the sync of the theme.js file:

  1. [sync] Create Figma plugin to generate a theme.js file #10 The first step is to sync the "styles" (how Figma names the design tokens). This is the simplest step. We can leverage the existing constraints. For instance, we have almost a direct mapping between the Figma palette and the JavaScript theme structure. We could build an import/export feature as a Figma plugin. The pain solved at this step are: a. easy migration between multiple Figma versions. b. easy prototyping with code or design. This is mostly for designers.
  2. [figma] Sync components between React and Figma #44 The second step is to sync the theme.components structure. This is more challenging, as it requires a deep knowledge of the React and Figma component structure. This could still be delivered as a Figma plugin. The pain solved at this step are: a. allowing developers and designer to easily collaborate. Make it easier to implement pixel-perfect designs, as well as backporting development constraints back to the designer realm. This is both for developers and designers.
  3. [figma] Export to React code #43 The third step exit the design system realm and enters the composition domain. It's about outputting React code from the Figma files (React -> Figma is a no-goal in this step). There is a challenge around using the right layout constraints and the most appropriate React components, Grid vs. Stack vs. Container vs. sx prop. The pain point is about making the handoff process a lot faster, saving time for the developers. At this step a Figma plugin is unlikely enough, it will very likely require a backend API to process the requests, as well as to help protect the IP (maybe for step 2 as well).
  4. The fourth step is about the extendability of the design system. Allowing the addition of new variants and props. This is an extension of step 2 that can isn't required for a minimal version.

@adrianmanea
Copy link
Collaborator

adrianmanea commented Dec 15, 2021

Some news on this topic,
image
There's a plugin created by AWS which syncs their Figma library theme with their AWS Amplify design system.

I'm not sure the technical specifics on how it works but I'm sure it needs some rules from the design system itself. I'm open to brainstorming this topic on a call anytime.

More info here: https://docs.amplify.aws/console/uibuilder/figmatocode/

@danilo-leal
Copy link

That's nice! We made a similar prototype during this year's hackathon where you could export the theme from Figma and just paste it into the code. There are numerous ideas in that sense we could definitely explore more. I think it would also be nice to have an integration to GitHub that, whenever the designer in Figma changes something from the theme, be it a type or color, it asks if the designer wants to create a pull request with the updates. I'm sure it's not trivial to do 😛 but it would integrate the workflows amazingly.

@adrianmanea

This comment was marked as resolved.

@oliviertassinari

This comment was marked as resolved.

@dusskapark
Copy link

dusskapark commented May 28, 2023

I'd like to add my opinion, well currently The "MUI for Figma" toolkit has relied on the Token studio and they officially support the style-dictionary export option https://docs.tokens.studio/transforming/style-dictionary

I thought Figma will announce their native Design-token management system soon though, but we all know that the adoption rate always needs a quite time. So, I'd like to suggest that MUI supports style-dictionary integration first for the existing customers of v5.11 FigmaKit and considers Figma's native design-token feature for your next FigmaKit v6

@skruegs
Copy link

skruegs commented Jun 7, 2023

@oliviertassinari Are there any current packages or apps to do the mapping from Figma tokens to MUI theme? https://github.com/mui/hackathon-figma-plugin 404's for me

@danilo-leal
Copy link

Hey there @skruegs, appreciate the questions! There are no "official" packages or apps from MUI for this yet ⎯ this one that you linked was our first attempt/experiment at tackling this ⎯ but we'll be hopefully soon giving updates about it. A new team member has recently joined (👋 @DavidCnoops) to iron the plug-in out.

Feel free to reach out in case you have any questions or suggestions ⎯ we'd love to hear them!

@DavidCnoops DavidCnoops self-assigned this Jun 14, 2023
@oliviertassinari
Copy link
Member Author

oliviertassinari commented Jun 23, 2023

https://github.com/mui/hackathon-figma-plugin 404's for me

@skruegs I have made the repository public. But yeah, it was a quick experimentation, outdated today.


@DavidCnoops I have created a small Toolpad app to display the GitHub avatars of the user who upvoted this issue: https://tools-public.mui.com/prod/pages/_-clGLR. this way, we could use it to gather qualitative feedback on what people expect and what we could build.

@dusskapark
Copy link

dusskapark commented Jul 25, 2023

@oliviertassinari Will this project be postponed to 2024?

@oliviertassinari
Copy link
Member Author

oliviertassinari commented Jul 26, 2023

@dusskapark It's very much at the top of our priority list. I think @DavidCnoops can provide more details on this.

@adrianmanea I have reorganized the public roadmap in https://github.com/mui/mui-design-kits/projects/1 to match MUI X and Core.

@DavidCnoops
Copy link
Contributor

DavidCnoops commented Jul 28, 2023

@dusskapark As Olivier mentioned it's indeed a priority of us and something that's currently in active development.

To provide some more details: We're building a Figma plugin that makes it possible to export (almost) all customizations applied in Figma on top of the MUI design kit directly to a theme file. These includes changes/customizations to both the design tokens (i.e. color palettes, elevations, border raddii etc.) as well as in-depth customizations to component styles (i.e. component-specific colors, paddings & margins, layout changes, effects, etc.). So that you can fully customize the look and feel of Material UI in Figma and automatically get a working, usable version on the code side without manually having to write a single line of code or CSS.

There's still quite a lot of work to be done but we already have a pretty extensive proof of concept and I'm confident we're going to be able to ship a first beta version before the end of the year.

@dusskapark
Copy link

@DavidCnoops Thank you for the detailed explanation. Is there any room for plugin developers, like me, to participate as an open source?

@oliviertassinari
Copy link
Member Author

Is there any room for plugin developers, like me, to participate as an open source?

@dusskapark On MUI's end, we don't intend to make this feature open source but instead to help it fund the work on the open source components. The ambition is to make this the seed of a much larger feature to help product teams create great design systems.

For open source collaboration, I think that you can connect with the author of https://www.figma.com/community/plugin/1192256903171420509/TSL---MUI-Theme-Exporter. It would be great to have a counter open source offering, it would help valid or invalid if the paid route MUI is taking is the most effective one.

@faner11
Copy link

faner11 commented Oct 27, 2023

@DavidCnoops Very much looking forward to your work, can you share some of the progress so far?

@dusskapark
Copy link

dusskapark commented Oct 27, 2023

https://www.linkedin.com/posts/figma_starting-today-you-can-now-bind-variables-activity-7138214989026189313-xKXI
Good news. Figma Variables is expended to other style properties!

I'm still waiting for this new feature. Well, hoping to get this as my Christmas present :)

@oliviertassinari oliviertassinari changed the title [figma] Create Figma plugin to sync with a theme.js file [connect] Create Figma plugin to sync with a theme.js file Dec 14, 2023
@oliviertassinari oliviertassinari added scope: sync Issues related to the Material UI Sync Figma plugin and removed waiting for 👍 Waiting for upvotes labels Dec 14, 2023
@tartakovsky
Copy link

tartakovsky commented Dec 31, 2023

@oliviertassinari @DavidCnoops

Hi guys, not sure where to ask, so asking here as well.

I just purchased a license for the kit: https://mui.com/store/items/figma-react/

I've been reading the GitHub issues for it.

From what I understand, the kit has just migrated from Token Studio to Figma Variables:
https://github.com/mui/mui-design-kits/releases/tag/v5.14.0

However, the plugin to export Figma Variables has not yet been developed:
#10

From what I understand, that takes away the ability to export tokens.json until the plugin is finished?

We're managing our design system in Token Studio and are planning to connect it to both MUI code and MUI kit, so I wanted to ask, while the plugin is still in development.

Could you please privately share the .json file with tokens you were using before v5.14.0 so the connection is easier for us? It's fine if it's not up to date, anything would help. E.g. here or to mui@3jane.com would work.

P.S.
Re desirability of the plugin, we'd definitely pay a token studio-sized subscription for it, would save us a lot of time :)

@dusskapark
Copy link

@tartakovsky

What I understand is that this plugin is not creating a token.json, but the ultimate goal is to generate a theme.ja file directly that needs to be applied in the end.

I'm thinking this is a slightly different concept from the design token. I think it's more similar to the feature that allows Token Studio to extract css files using AWS style dictionary

@DavidCnoops
Copy link
Contributor

DavidCnoops commented Feb 23, 2024

@tartakovsky Apologies for the late reply on my end. To provide an update with regards to the plugin: It's currently in the process of being published to the Figma Community. Once the plugin is approved (normally takes 5 to 10 days) you'll be able to install and test it. So if everything goes according to plan the plugin should be available somewhere in the first week of March.

The plugin will be able to generate a theme file (theme.js) for your Material UI design kit including any changes/customizations made to design tokens (both the ones defined as Variables and those defined as Styles). So you'll be able to, for example, create your own color palette or define your custom collection of shadows, border radii, typography styles, etc. in Figma and the plugin will be able to convert all these tokens to a valid Material UI theme file. Next to that we're also adding support for in-depth component customizations. You'll be able to fully customize the various variants and states of a component in the design kit to create your own distinct look and feel for a component. And once you're happy use the plugin to generate the correct theme styles for these component customizations. The first release will have support for the Button and Switch components, but we'll be quickly expanding the list of supported components afterwards and ultimately offer support for all components present in the design kit.

@dusskapark
Copy link

@DavidCnoops I haven't found this plugin yet ( already 14 days), is there any problem with it?

@HunterJFrey
Copy link

Are there any updates on this plugin, or recommended approaches for manually converting the figma export to an MUi theme?

@danilo-leal
Copy link

danilo-leal commented Mar 28, 2024

Hey folks — excited to share that Figma is reviewing the plugin publication as we speak; thus, it should very soon be out in beta for you all to try. I'll definitely report back here once it's published!

@jbhurruth
Copy link

Looks like its up!

@dusskapark
Copy link

dusskapark commented Apr 5, 2024

Good! Looking forward to announcement and guide docs

https://mui.com/material-ui/design-resources/material-ui-sync/

@danilo-leal
Copy link

Y'all are fast—super nice to see early interest! The plugin's live and ready to be tested! If you find any bugs or want to report something, please drop a comment here or use the "Feedback" button available directly on the plugin. We're on our way to making a larger release comms about it, as well as publishing the docs mentioned above (which I apologize isn't out yet 😞).

@danilo-leal danilo-leal changed the title [connect] Create Figma plugin to sync with a theme.js file [sync] Create Figma plugin to generate a theme.js file May 2, 2024
@danilo-leal
Copy link

We just got an official word out about Sync's (the updated name for the plugin!) beta release — check out the tweet and let us know any feedback; we're excited to see y'all continue to try it! 😃

@Morti
Copy link

Morti commented Jun 19, 2024

This is great, was looking into trying to extract the styles myself from the Figma api but this plugin would make it really easy to get our designs into code. Looking forward to updates with more components, any updates on when more will be coming?

Also when testing this plugin I noticed that it extracts the theme in a format that is not supported by createTheme, is there a reason for that? Specifically the first section with colorSchemes. Had to change it to get it to work with createTheme

@dusskapark
Copy link

dusskapark commented Jun 19, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
figma new feature New feature or request scope: sync Issues related to the Material UI Sync Figma plugin
Projects
Status: Next in queue
Development

No branches or pull requests