React component that renders a fully adaptable grid of flat-topped hexagons using SVG. The component fills the container with the hexagons, adapting their size properly.
react-hexagon-grid
can be installed using npm:
npm install --save react-hexagon-grid
import React from 'react';
import HexagonGrid from 'react-hexagon-grid';
const hexagons = [... /* Put your content here */];
React.render(
<HexagonGrid
gridWidth=300
gridHeight=200
hexagons={hexagons}
/>,
document.getElementById('root')
);
See the demo for a working example.
gridWidth
- The width, in pixel, of the grid (required)gridHeight
- The height, in pixel, of the grid (required)hexagons
- An array of hexagon objects (required)renderHexagonContent
- A function to render the content of each hexagonhexProps
- The props that will be assigned to each hexagon
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request