2.0.1 • Published 2 years ago

@selectable-grid/react v2.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

@selectable-grid/react

Install

npm install --save @selectable-grid/react

Usage example

import React from 'react'
import SelectableGrid from '@selectable-grid/react'

const App = () => {
  return (
    <div style={{ position: 'relative' }}>
      <SelectableGrid
        cellCount={20}
        type='img'
        containerProps={{
          src: 'spanch-bob.webp'
        }}
      />
    </div>
  )
}

export default App

Properties

PropertyRequiredTypeDescription
typetrue'img' | 'video'name of html tag
containerPropstrueobjectif prop type is equal 'img' containerProps is HTML Attributes of the <img /> tag, else prop type is equal 'video' containerProps is HTML Attributes of the <video />
cellCounttruenumbercount of the cell in the grid
mouseMovefalsefunction(area: {x: number, y: number, w: number, h: number}, selectArea: {x: number, y: number, w: number, h: number}, e: MouseEvent){}handler of mouse move on the grid
mouseDownfalse(point: {x: number, y:number}, e: MouseEvent) => voidhandler of mouse down on the grid
mouseUpfalse(area: {x: number, y: number, w: number, h: number}, selectArea: {x: number, y: number, w: number, h: number}, e: MouseEvent) => voidhandler of mouse up on the grid
cellsStylesfalse{fillStyle: string}color like as color for canvas
gridStylesfalse{strokeStyle: string}color like as color for canvas
areaStylesfalse{strokeStyle: string, fillStyle: string}color like as color for canvas
isAreafalsebooleanshow area on the grid
keepAreafalsebooleanshow area on the grid
isCellsfalsebooleanrender cells on the grid
isGridfalsebooleanrender grid on the grid
canvasClassNamefalsestringclass name of the canvas

Another packages

selectable-grid

@selectable-grid/react