Gathering detailed insights and metrics for react-hexagon
Gathering detailed insights and metrics for react-hexagon
Gathering detailed insights and metrics for react-hexagon
Gathering detailed insights and metrics for react-hexagon
npm install react-hexagon
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
69 Stars
25 Commits
21 Forks
2 Watching
1 Branches
2 Contributors
Updated on 29 Oct 2024
Minified
Minified + Gzipped
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-7.1%
52
Compared to previous day
Last week
16.6%
274
Compared to previous week
Last month
6.4%
1,140
Compared to previous month
Last year
-6.9%
17,735
Compared to previous year
React component that renders a hexagon using SVG. Supports background images, links, SVG content, click handlers... Stylable with CSS.
See the demos page for some demos.
react-hexagon
can be installed using npm:
npm install --save react-hexagon
Size of component is about ~1.5kB after gzip.
1import React from 'react' 2import Hexagon from 'react-hexagon' 3 4React.render( 5 <Hexagon 6 style={{stroke: '#42873f'}} 7 backgroundImage="img/red-panda.jpg" 8 href="http://espen.codes/" 9 />, 10 document.getElementById('root') 11);
All properties are optional.
className
- Class name of SVG element.href
- Link target, if any. Hexagon will only be wrapped in an anchor if this is set.target
- Target of link. Same role as in regular HTML.flatTop
- Switches hexagon style to have a flat top (basically, rotate the hexagon by 90°). Default: false
backgroundImage
- URL to a background image. Recommend that the image has the same aspect ratio as a hexagon. See background sizing notes below.style
- Styles for the hexagon element.children
- Children nodes to put inside SVG element.hexProps
- Arbitrary properties to apply to the hexagon element (the actual polygon, not the outer SVG). Useful to apply event listeners, class names or similar.diagonal
- Size of diagonal. Affects sizing of elements within the SVG, and can usually be left as-is. Instead, scale the SVG element using CSS width/height. Default: 500
Sizing and aligning the background image can be slightly tricky. We recommend that you try to stick with images that has the same aspect ratio as a hexagon, or square images that can be slightly scaled.
By default, if you give the hexagon element a background image with a different aspect ratio, it'll try to center the image horizontally/vertically while maintaining the original image aspect ratio. For square images, this means you'll end up with a small border. If you instead want to upscale the image to fill the hexagon, use the backgroundScale
property (see below).
Background sizing properties are resolved in the following order (first one defined wins):
backgroundScale
- Used to upscale the image, usually in order to fill the entire hexagon if the aspect ratio does not match. 0.5
mean scale to 50% of the hexagon, 1.5
means scale to 150%. For square images, 1.05
is usually a good number to use.backgroundWidth
/ backgroundHeight
- Used to manually adjust the size of the background image.backgroundSize
- Can be used if the image has a square ratio.Note: backgroundWidth
, backgroundHeight
and backgroundSize
are relative to the diagonal
, which defaults to 500
.
Licensed under the MIT License, see LICENSE
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 1/24 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
73 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More