Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vx/pattern

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vx/pattern - npm Package Compare versions

Comparing version 0.0.100 to 0.0.109

2

package.json
{
"name": "@vx/pattern",
"version": "0.0.100",
"version": "0.0.109",
"description": "vx pattern",

@@ -5,0 +5,0 @@ "main": "build/index.js",

# @vx/pattern
Inspired by: http://riccardoscalco.github.io/textures/
## Example
``` js
import Shape from '@vx/shape';
import Pattern from '@vx/pattern';
const PatternArea = () => {
return (
<svg>
<Pattern.Lines
id="lines"
height={5}
width={5}
stroke={'black'}
strokeWidth={1}
orientation={['diagonal']}
/>
<Shape.AreaClose fill="url('#lines')" />
</svg>
);
};
```
## The Definition Caveat
Like gradients, patterns are "defined." When you put down a `<Pattern.XYZ />`, it's putting a [`<pattern/>`](https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Patterns) 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
### `Patterns.Circles`
![circles example](http://i.imgur.com/jd9YGJi.png)
``` js
<Pattern.Circles
id="circles"
height={6}
width={6}
stroke={'black'}
strokeWidth={1}
/>
```
### `Patterns.Hexagons`
![hexagon example](http://i.imgur.com/3EL1Lza.png)
``` js
<Pattern.Hexagons
id="hexagons"
height={3}
size={8}
stroke={'red'}
strokeWidth={1}
/>
```
### `Patterns.Lines`
![lines example](http://i.imgur.com/E3cTmLZ.png)
``` js
<Pattern.Lines
id="lines"
height={5}
width={5}
stroke={'black'}
strokeWidth={1}
orientation={['diagonal']}
/>
```
### `Patterns.Waves`
![waves example](http://i.imgur.com/4fdwbhv.png)
``` js
<Pattern.Waves
id="waves"
height={4}
width={4}
stroke={'blue'}
strokeWidth={1}
/>
```
## Source For Components
+ [`<Pattern.Circles />`](https://github.com/hshoff/vx/blob/master/packages/vx-pattern/src/patterns/Circles.js)
+ [`<Pattern.Hexagons />`](https://github.com/hshoff/vx/blob/master/packages/vx-pattern/src/patterns/Hexagons.js)
+ [`<Pattern.Lines />`](https://github.com/hshoff/vx/blob/master/packages/vx-pattern/src/patterns/Lines.js)
+ [`<Pattern.Path />`](https://github.com/hshoff/vx/blob/master/packages/vx-pattern/src/patterns/Path.js)
+ [`<Pattern.Pattern />`](https://github.com/hshoff/vx/blob/master/packages/vx-pattern/src/patterns/Pattern.js)
+ [`<Pattern.Path />`](https://github.com/hshoff/vx/blob/master/packages/vx-pattern/src/patterns/Waves.js)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc