Giter Site home page Giter Site logo

rvg.js's Introduction

RVG.js

Super-powered SVG in React, by Chris Hutchinson

About

RVG.js standardises the creation of isomorphic SVG in React by providing super-powered elements. It can be used with both the ReactDOM.render() and ReactDOMServer.renderToString() methods.

Usage

Install via npm:

$ npm install rvg.js

Require into your project:

const RVG = require('rvg');
const SVG = RVG.SVG;
const Circle = RVG.Circle;

You can also select which elements you wish to use:

const {
  SVG,
  Line,
  Rectangle,
  Text
} = require('rvg');

Create your SVG using React:

render() {
  return (<SVG width={500} height={400} fill="#333">

            <Rectangle fill="darkgreen" x={200} y={100} height={100} width={50} />

            <Text x={20} y={100} fontFamily="Arial" fontSize={40} lineHeight={50} fill="#FFF">
              {'This is a text string'}
              {'broken over'}
              {'multiple lines'}
            </Text>

          </SVG>);
}

Elements

<SVG />

<Text />

<Circle />

<Ellipse />

<Line />

<Rectangle />

<Image />

To do

  • Make the <Text /> element support automatic text wrapping
  • Add some tests
  • Build a better example
  • Handle inlining of custom fonts and provide example
  • Gradients
  • Polylines
  • Animation (?!)
  • Groups

rvg.js's People

Contributors

chrishutchinson avatar emre-one avatar

Watchers

James Cloos 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.