Little wrapper (+ types) for the Figma API
Clone or download
Latest commit 3098141 Jul 27, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci Initial commit Mar 23, 2018
.github Initial commit Mar 23, 2018
.vscode Initial commit Mar 23, 2018
src Add extra params to FileImage request Jul 26, 2018
.gitignore feat: Create Figma client Mar 26, 2018
.npmignore Initial commit Mar 23, 2018
.prettierignore Initial commit Mar 23, 2018
CHANGELOG.md chore(release): 1.2.0 Mar 27, 2018
LICENSE Initial commit Mar 23, 2018
README.md 📝 Updated README for OAuth usage (#5) Apr 2, 2018
package.json v1.5.1 Jul 26, 2018
tsconfig.json Initial commit Mar 23, 2018
tsconfig.module.json Change module target from esnext -> es5 May 9, 2018
tslint.json Initial commit Mar 23, 2018

README.md

Figma.js

A simple wrapper for the Figma API

Cool projects using this:

Usage

Full documentation is available on the web, and most everything is typed with Typescript.

Creating a client

Quickest start is to grab a personal access token from your Figma account settings page

import * as Figma from 'figma-js';

const token = '12345';

const client = Figma.Client({
  personalAccessToken: token
});

Alternatively, if you're building an app with OAuth authentication, after you get back the OAuth access token…

import * as Figma from 'figma-js';

const token = '12345';

const client = Figma.Client({
  accessToken: token
});

Doing cool things

Once you have instantiated a client, have fun!

client.file('file-id').then(({ data }) => {
  console.log(data);
});

Just reusing types

All of the types in the Figma file format / API are exported.

import * as Figma from 'figma-js';

const textNode: Figma.Text = {
  // … this should autocomplete if your editor is set up for it!
};

Contributing

We used the typescript-starter repo for this - refer to its README for more detailed instructions.

Helpful development commands:

yarn watch
yarn docs
yarn docs:publish

Contributions welcomed

Committing

yarn global add commitizen

# instead of git commit

git cz

Contributors