Giter VIP home page Giter VIP logo

react-svg-textures's Introduction

react-svg-textures ⭐

Textures.js in React made simple ⚡. react-svg-textures is a port of the Textures.js library as React components with multiple options via props for easy usage!

npm version

Installation

Using Yarn:

yarn add react-svg-textures

Using NPM:

npm install react-svg-textures

Usage

import React from 'react';
import { Lines } from 'react-svg-textures';

const Texture = () => (
  <svg width={200} height={200}>
    <Lines
      id='pattern'
      strokeWidth={10}
      stroke='purple'
      size={10}
      orientation='diagonal'
      background='blue'
    />
    <circle cx={100} cy={100} r={5} fill='url(#pattern)' />
  </svg>
);

export default Texture;

Available Props Options

import PropTypes from 'prop-types';
import { Lines, Circles, Paths } from 'react-svg-textures';

Lines.propTypes = {

    // size must be a number
    size: PropTypes.number,

    // strokeWidth must be a number
    strokeWidth: PropTypes.number,

    // orientation must be a string
    orientation: PropTypes.string,

    // shapeRendering must be a string
    shapeRendering: PropTypes.string,

    // stroke must be a string
    stroke: PropTypes.string,

    // background must be a string
    background: PropTypes.string,

    // id must be a string
    id: PropTypes.string

};

Circles.propTypes = {

    // size must be a number
    size: PropTypes.number,

    // strokeWidth must be a number
    strokeWidth: PropTypes.number,

    // stroke must be a string
    stroke: PropTypes.string,

    // background must be a string
    background: PropTypes.string,

    // id must be a string
    id: PropTypes.string,

    // complement must be a boolean
    complement: PropTypes.bool,

    // radius must be a number
    radius: PropTypes.number

};

Paths.propTypes = {

    // size must be a number
    size: PropTypes.number,

    // d must be 'squares', 'nylon', 'waves', 'woven', 'caps', 'crosses' or 'hexagons'
    d: PropTypes.oneOf([
        'squares',
        'nylon',
        'waves',
        'woven',
        'caps',
        'crosses',
        'hexagons'
    ])

    // strokeWidth must be a number
    strokeWidth: PropTypes.number,

    // shapeRendering must be a string
    shapeRendering: PropTypes.string,

    // stroke must be a string
    stroke: PropTypes.string,

    // background must be a string
    background: PropTypes.string,

    // id must be a string
    id: PropTypes.string,

};

License

MIT License

Copyright (c) 2018 Finn Fitzsimons

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

react-svg-textures's People

Contributors

finnfiddle avatar ixahmedxi avatar

Watchers

 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.