MCPcopy
hub / github.com/airbnb/react-sketchapp

github.com/airbnb/react-sketchapp @v3.2.2 sqlite

repository ↗ · DeepWiki ↗ · release v3.2.2 ↗
361 symbols 954 edges 207 files 0 documented · 0%
README

react-sketchapp

render React components to Sketch; tailor-made for design systems

Quick-start 🏃‍

First, make sure you have installed Sketch version 50+, & a recent npm.

Open a new Sketch file, then in a terminal:

git clone https://github.com/airbnb/react-sketchapp.git
cd react-sketchapp/examples/basic-setup && npm install

npm run render

Next, check out some more examples!

readme-intro

npm Sketch.app Travis

Why?!

Managing the assets of design systems in Sketch is complex, error-prone and time consuming. Sketch is scriptable, but the API often changes. React provides the perfect wrapper to build reusable documents in a way already familiar to JavaScript developers.

What does the code look like?

import * as React from 'react';
import { render, Text, Artboard } from 'react-sketchapp';

const App = props => (
  <Artboard>
    <Text style={{ fontFamily: 'Comic Sans MS', color: 'hotPink' }}>{props.message}</Text>
  </Artboard>
);

export default context => {
  render(<App message="Hello world!" />, context.document.currentPage());
};

What can I do with it?

  • Manage design systems— react-sketchapp was built for Airbnb’s design system; this is the easiest way to manage Sketch assets in a large design system
  • Use real components for designs— Implement your designs in code as React components and render them into Sketch
  • Design with real data— Designing with data is important but challenging; react-sketchapp makes it simple to fetch and incorporate real data into your Sketch files
  • Build new tools on top of Sketch— the easiest way to use Sketch as a canvas for custom design tooling

Found a novel use? We'd love to hear about it!

Read more about why we built it

Documentation

Extension points exported contracts — how you extend this code

IntrinsicElements (Interface)
(no doc)
src/types/intrinsic.d.ts
SwatchProps (Interface)
(no doc)
examples/basic-setup-typescript/src/my-command.tsx
DocumentProps (Interface)
(no doc)
examples/basic-setup-typescript/src/my-command.tsx

Core symbols most depended-on inside this repo

isDefined
called by 38
src/utils/isDefined.ts
makeColorFromCSS
called by 35
src/jsonUtils/models.ts
generateID
called by 21
src/jsonUtils/models.ts
makeRect
called by 20
src/jsonUtils/models.ts
makeBorderOptions
called by 12
src/jsonUtils/style.ts
makeResizeConstraint
called by 8
src/jsonUtils/resizeConstraint.ts
getDocumentData
called by 6
src/utils/getDocument.ts
getSketchVersion
called by 6
src/utils/getSketchVersion.ts

Shape

Function 200
Class 90
Method 68
Interface 3

Languages

TypeScript100%

Modules by API surface

src/symbol.tsx18 symbols
src/jsonUtils/models.ts12 symbols
src/stylesheet/index.ts8 symbols
src/sharedStyles/TextStyles.ts8 symbols
src/renderers/SymbolInstanceRenderer.ts8 symbols
src/jsonUtils/shapeLayers.ts8 symbols
src/utils/sharedTextStyles/index.sketch.ts7 symbols
src/render.tsx7 symbols
src/platformBridges/sketch/findFontName.ts7 symbols
src/jsonUtils/textLayers.ts7 symbols
src/utils/sharedTextStyles/index.ts6 symbols
src/utils/Context.ts6 symbols

Dependencies from manifests, versioned

@lona/svg-model2.0.0 · 1×
@sketch-hq/sketch-file-format-ts4.0.3 · 1×
@skpm/babel-preset0.2.1 · 1×
@skpm/builder0.7.4 · 1×
@skpm/test-runner0.4.1 · 1×
@types/airbnb-prop-types2.13.1 · 1×
@types/chroma-js1.3.3 · 1×
@types/invariant2.2.31 · 1×
@types/jest25.2.1 · 1×
@types/node13.13.2 · 1×
@types/pegjs0.10.1 · 1×
@types/react16.9.34 · 1×

For agents

$ claude mcp add react-sketchapp \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact