0.0.199 • Published 5 years ago

@vx/pattern v0.0.199

Weekly downloads
45,907
License
MIT
Repository
github
Last release
5 years ago

@vx/pattern

Inspired by: http://riccardoscalco.github.io/textures/

Example

import { AreaClosed } from '@vx/shape';
import { PatternLines } from '@vx/pattern';

const PatternArea = () => {
  return (
    <svg>
      <PatternLines
        id="lines"
        height={5}
        width={5}
        stroke={'black'}
        strokeWidth={1}
        orientation={['diagonal']}
      />
      <AreaClosed fill="url('#lines')" />
    </svg>
  );
};

The Definition Caveat

Like gradients, patterns are "defined." When you put down a <PatternXYZ />, it's putting a <pattern/> attribute in the SVG.

It's often better to think of these as variable definitions rather than true DOM elements. When you use fill="url('#pattern')" you're referencing the pattern's id: pattern.

Pre-Made Patterns

PatternsCircles

circles example

<PatternCircles id="circles" height={6} width={6} stroke={'black'} strokeWidth={1} />

PatternsHexagons

hexagon example

<PatternHexagons id="hexagons" height={3} size={8} stroke={'red'} strokeWidth={1} />

PatternsLines

lines example

<PatternLines
  id="lines"
  height={5}
  width={5}
  stroke={'black'}
  strokeWidth={1}
  orientation={['diagonal']}
/>

PatternsWaves

waves example

<PatternWaves id="waves" height={4} width={4} stroke={'blue'} strokeWidth={1} />

Installation

npm install --save @vx/pattern
0.0.199

5 years ago

0.0.198

5 years ago

0.0.197

5 years ago

0.0.196

5 years ago

0.0.195

5 years ago

0.0.194

5 years ago

0.0.193

5 years ago

0.0.193-alpha.2

5 years ago

0.0.193-alpha.1

5 years ago

0.0.193-alpha.0

5 years ago

0.0.192

6 years ago

0.0.189

6 years ago

0.0.183

6 years ago

0.0.182

7 years ago

0.0.179

7 years ago

0.0.165

7 years ago

0.0.165-beta.1

7 years ago

0.0.165-beta.0

7 years ago

0.0.161

7 years ago

0.0.153

7 years ago

0.0.143

8 years ago

0.0.140

8 years ago

0.0.136

8 years ago

0.0.127

8 years ago

0.0.126

8 years ago

0.0.125

8 years ago

0.0.120

8 years ago

0.0.112

8 years ago

0.0.111

8 years ago

0.0.110

8 years ago

0.0.109

8 years ago

0.0.100

8 years ago

0.0.84

8 years ago

0.0.79

8 years ago

0.0.78

8 years ago

0.0.75

8 years ago

0.0.73

8 years ago

0.0.72

8 years ago