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

react-grid-select

Package Overview
Dependencies
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-grid-select

A React component to select a grid size from an available space

  • 0.0.3
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-33.33%
Maintainers
2
Weekly downloads
 
Created
Source

react-grid-select

A React component to select a grid size from an available space

version Monthly downloads gzip size All Contributors Build Status MIT License PRs Welcome

Example

Example

Demo

Check out the examples:

Installation

yarn add react-grid-select

or

npm install react-grid-select

Basic usage

import GridSelect from "react-grid-select";

const Demo = () => {
  const [selectedArea, setSelectedArea] = useState({ width: null, height: null });

  return (
    <GridSelect
      cols={5}
      rows={5}
      onRegionUpdate={setSelectedArea}
    />
  );
};

Props

PropTypeDefaultDescription
rowsnumber5The number of rows in the grid
colsnumber5The number of columns in the grid
onRegionUpdateFunctionLog to consoleFunction describing what to do with the selected area information. Probably set this to a state variable
cellSizenumber25Size of each grid cell in pixels
bounds{ maxWidthBlock: { width: number; height: number; }; maxHeightBlock: { width: number; height: number; }; };NoneEnabled area of the grid. By default the whole grid is enabled
disabledbooleanfalseWhether or not the grid is currently disabled. Disabling will pause the grid in it's current state and apply the disabled style
stylesobjectSee belowCustom styles to apply to the grid

Styles

All default styles can be overridden by using the styles prop which accepts the below options

StylesDefaults
active{ border: "1px solid #4d6cdd", background: "#4d6cdd" }
hover{ border: "1px solid #fff" }
cell{ width: cellSize, height: cellSize, background: "#bababa", cursor: "pointer", borderRadius: 3, border: "1px solid #bababa" }
grid{ position: "relative", display: "grid", color: "#444", margin: "25px 0", gridGap: "4px 6px", gridTemplateColumns: Array(cols).fill(${cellSize}px).join(" ") }
disabled{ filter: "brightness(0.7)" }

License

MIT

FAQs

Package last updated on 16 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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