react-figma

A React renderer for Figma
GitHub
2.54k
Created 5 years ago, last commit 9 days ago
29 contributors
1.32k commits
Stars added on GitHub, month by month
N/A
N/A
N/A
N/A
N/A
N/A
N/A
N/A
N/A
N/A
10
11
12
1
2
3
4
5
6
7
8
9
2023
2024
Stars added on GitHub, per day, on average
Yesterday
+3
Last week
+0.4
/day
Last month
+0.3
/day
Package on NPM
Monthly downloads on NPM
10
11
12
1
2
3
4
5
6
7
8
9
2023
2024
README

React Figma

React Figma logo by Lera Lesik

npm version CircleCI

A React renderer for Figma. Use React components as a source for your designs.

Example of code:

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

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

Installation

Using boilerplate

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

From scratch

Install it with yarn:

yarn add react react-figma

Or with npm:

npm i react react-figma --save

Usage

Configure main thread

import { setupMainThread } from 'react-figma/rpc';

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

setupMainThread();

Configure ui thread

import * as React from 'react';
import { App } from './App';

import 'react-figma/rpc';
import { render } from 'react-figma';

render(<App />);

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

Sponsoring

Become a backer and get your logo on our Readme on GitHub with a link to your site.

Become a sponsor and get your logo on our README on GitHub with a link to your site.

Contributing

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

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:

Tested with browserstack

Tested with browserstack

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

๐Ÿ’ป
sprashad
sprashad

๐Ÿ“–
Vivian Lee
Vivian Lee

๐Ÿ’ป
macintoshhelper
macintoshhelper

๐Ÿ’ป
Pierre Grimaud
Pierre Grimaud

๐Ÿ“–
Greg Westneat
Greg Westneat

๐Ÿ’ป
Marius Reimer
Marius Reimer

๐Ÿ’ป
szeko
szeko

๐Ÿ’ป
Jonathan Holmes
Jonathan Holmes

๐Ÿ“–
headwindz
headwindz

๐Ÿ’ป
Darรญo Hereรฑรบ
Darรญo Hereรฑรบ

๐Ÿ“–
Konstantin Popov
Konstantin Popov

๐Ÿ“–
Utkarsh Singh
Utkarsh Singh

๐Ÿ“–
mrkenneh
mrkenneh

๐Ÿ’ป
Anna Do
Anna Do

๐Ÿ’ป
Steven Petryk
Steven Petryk

๐Ÿ’ป
Thierry Charbonnel
Thierry Charbonnel

๐Ÿ“–
Jack Oliver
Jack Oliver

๐Ÿ“–
Marc Abramowitz
Marc Abramowitz

๐Ÿ“–
fishtriangle
fishtriangle

๐Ÿ’ป
Carlos
Carlos

๐Ÿ“–
Raghu Ram M
Raghu Ram M

๐Ÿ“–

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