0.0.199 • Published 4 years ago

@vx/pattern v0.0.199

Weekly downloads
45,907
License
MIT
Repository
github
Last release
4 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

4 years ago

0.0.198

4 years ago

0.0.197

4 years ago

0.0.196

4 years ago

0.0.195

4 years ago

0.0.194

4 years ago

0.0.193

4 years ago

0.0.193-alpha.2

4 years ago

0.0.193-alpha.1

4 years ago

0.0.193-alpha.0

4 years ago

0.0.192

5 years ago

0.0.189

5 years ago

0.0.183

5 years ago

0.0.182

5 years ago

0.0.179

6 years ago

0.0.165

6 years ago

0.0.165-beta.1

6 years ago

0.0.165-beta.0

6 years ago

0.0.161

6 years ago

0.0.153

6 years ago

0.0.143

7 years ago

0.0.140

7 years ago

0.0.136

7 years ago

0.0.127

7 years ago

0.0.126

7 years ago

0.0.125

7 years ago

0.0.120

7 years ago

0.0.112

7 years ago

0.0.111

7 years ago

0.0.110

7 years ago

0.0.109

7 years ago

0.0.100

7 years ago

0.0.84

7 years ago

0.0.79

7 years ago

0.0.78

7 years ago

0.0.75

7 years ago

0.0.73

7 years ago

0.0.72

7 years ago