GithubHelp home page GithubHelp logo

doc22940 / react-figma Goto Github PK

View Code? Open in Web Editor NEW

This project forked from react-figma/react-figma

2.0 2.0 0.0 14.02 MB

Render React components to Figma

Home Page: https://react-figma.now.sh

License: MIT License

TypeScript 95.19% JavaScript 3.93% CSS 0.88%

react-figma's Introduction

React Figma

React Figma logo by Lera Lesik

All Contributors npm version CircleCI Join the community on Spectrum

Render React components to Figma.

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>
    );
};

โš ๏ธ 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-prebuilt

Or with npm:

npm i react react-figma yoga-layout-prebuilt --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 />, figma.root);

Configure ui thread

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

const handler = uiWorker({ yoga, fetch });

onmessage = event => {
    handler(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>
    );
};

Docs

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!

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

๐Ÿ’ป

Losev Yaroslav

๐Ÿ’ป

Vishnu Singh

๐Ÿ’ป

corrina

๐Ÿ’ป

Zachary Witt

๐Ÿ’ป

Abdelrahman Ashraf

๐Ÿ’ป

sprashad

๐Ÿ“–

Vivian Lee

๐Ÿ’ป

macintoshhelper

๐Ÿ’ป

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

react-figma's People

Contributors

allcontributors[bot] avatar corrinachow avatar dependabot[bot] avatar hvish avatar ilyalesik avatar losyear avatar macintoshhelper avatar theashraf avatar wyvl avatar zqwitt avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.