question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Structuring design system with react-figma

See original GitHub issue

Hi 👋

I’m currently a figma and react/react-native user. The little startup my friends and I are working on have several UI primitives that we use and compose together to create more complex UI. Currently we’re in a situation where

  1. Our figma designs of our components get updated in figma and we have to go and update both our webapp and react-native app with the updates to those components.
  2. Our components are updated in the webapp/react-native app and we have to go update the figma board to keep them in sync.

This wasn’t much of an issue at first when we had 10 -30 components. But as our primitives got larger so did our “molecules” that are composed from primitives and updating all of them in figma and code is starting to become a full on task that is pretty tedious.

How can we leverage react-figma to mitigate this issue? We’re not design or design-system experts by any means but this has been a pain point for us and really would prefer to create a component-library that we would import into our application and have things “just work”.

We also use emotion for styling our webapp and react-native app so we’re not quite sure how much of a barrier that is.

Would love any insight into this 🙏

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
macintoshhelpercommented, May 15, 2020

Hi, to share code between web, React Native and React Figma, I would recommend building a React Native/Primitives component library with react-primitives (together with @emotion/primitives if you’d like to use Emotion). This can be in a separate directory, or bundled with Rollup – creating a build for each platform using platform extension cascading. Here’s an example of a cross-platform Rollup config: https://github.com/elemental-design/elemental-react/blob/master/rollup.config.js . You may find that Webpack plugin equivalents don’t exist for Rollup though (I built rollup-plugin-mdx because of this) – and Rollup is generally considered better than Webpack for npm packages that will be consumed by a parent app. You’d want to make sure packages like emotion/styled-components are marked as external too and only installed in the entrypoint.

You can use Webpack aliasing too, which is a pattern commonly used with react-native-web, but this will be effectively untyped (e.g. react-figma is unlikely to be exporting a <FlatList> component, but TypeScript may not warn you about this).

So long as your primitive UI components render the same cross-platform, you can build UIs with them that remain cross-platform.

Here’s one pattern that could be used: https://github.com/elemental-design/primer-components/blob/master/src/Button.js

With a styled-components (or can be emotion) polyfill to make styled.div work: https://github.com/elemental-design/primer-components/blob/master/figma/src/styled.js . Or can just use react-primitives and react-native-web, there may be issues with Emotion SSR though with react-native-web.

Getting it production ready may be some work though (especially if you want to use SSR, code splitting, etc).

1reaction
ilyalesikcommented, May 9, 2020

@leggomuhgreggo I sent you invite. 🙌

Read more comments on GitHub >

github_iconTop Results From Across the Web

Design system for React & Figma. Web app templates
Figma React UI kit — designed in Figma and exported to React to build web apps faster. Based on restyled Blueprint.js library. Powered...
Read more >
Structuring Design Systems in Figma - YouTube
In this tutorial, I have a high-level discussion with an example of how to structure a team within Figma for your design system...
Read more >
Design with React components in Figma - YouTube
Managing Design Token Themes · How to Convert Figma Components to React Components with Amplify · Converting Figma designs into React Components ...
Read more >
Mastering design systems components in Figma - Jan Toman
Figma # DesignSystem #UIKit #UIDesign ⚡️Want to dive deeper Into Design Systems ?Get 20 hours of top-quality content from our Design Systems ......
Read more >
Composition-Based Design System In Figma
At the same time, Figma has been peeking over developers' shoulders for layout building tools (like auto-layout, variants with properties, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found