Skip to content

paulogdm/react-figma

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

350 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

React Figma

All Contributors npm version CircleCI Join the community on Spectrum

Render React components to Figma.

  • πŸ’‘ Inspired by react-sketchapp.
  • 🎨 Designed to create manageable design systems.
  • πŸ¦„ Flexible layouts support with Yoga Layout
  • ♻️ Hydration support.
  • βš™οΈ Built on Figma Plugin API.

Example of code:

import * as React from 'react';
import { Page, Rectangle, Text } from 'react-figma';

export const App = () => {
    return (
        <Page name="New page">
            <Rectangle style={{ width: 200, height: 100, backgroundColor: '#dd55aa' }} />
            <Text characters="text" style={{ color: '#ffffff' }} />
        </Page>
    );
};

⚠️ Warning!️ Project is not production ready and currently at alpha version. API can be changed.

Installation

Using boilerplate

You can use react-figma-boilerplate for creating own projects.

From scratch

Install it with yarn:

yarn add react react-figma yoga-layout

Or with npm:

npm i react react-figma yoga-layout --save

Usage

Configure main thread

import * as React from 'react';
import { render, subscribeOnMessages } from 'react-figma';
import { App } from './App';

figma.showUI(__html__, { visible: false });

figma.ui.onmessage = message => {
    subscribeOnMessages(message);
};

render(<App />);

Configure ui thread

import * as yoga from 'yoga-layout';
import { uiWorker } from 'react-figma';

onmessage = event => {
    uiWorker({ yoga })(event);
};

Import components

import * as React from 'react';
import { Page, Rectangle, Text } from 'react-figma';

export const App = () => {
    return (
        <Page name="New page">
            <Rectangle style={{ width: 200, height: 100, backgroundColor: '#dd55aa' }} />
            <Text characters="text" style={{ color: '#ffffff' }} />
        </Page>
    );
};

Examples

Become a Contributor πŸŽ–

Whether you're helping us implement features, fix bugs or improve the docs, we'd love to have you as part of the community!

Reasons to be a contributor

  • You pump your knowledge about:
    • React. Best way to figure out how React works - implementing custom renderer. In the project we operate with most advanced concepts: Reconciliation, Hooks etc.
    • Figma Plugins creation.
    • Yoga Layout
    • RxJS
  • Take a place at the contributors list. πŸ˜‰

How to Contribute

Check out our Contributing Guide for ideas on contributing and setup steps for getting repository up and running on your local machine.

Acknowledgements

React Figma team wishes to thank the following invaluable contributions:

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Ilya Lesik
Ilya Lesik

πŸ’»
Losev Yaroslav
Losev Yaroslav

πŸ’»
Vishnu Singh
Vishnu Singh

πŸ’»
corrina
corrina

πŸ’»
Zachary Witt
Zachary Witt

πŸ’»
Abdelrahman Ashraf
Abdelrahman Ashraf

πŸ’»

This project follows the all-contributors specification. Contributions of any kind welcome!

About

Render React components to Figma

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 99.9%
  • JavaScript 0.1%