New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-crop-selector

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-crop-selector

Select crop boundaries in an image

  • 1.3.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

react-crop-selector

react-crop-selector helps users define crop boundaries in an image (or technically just in any area). It does not actually do any cropping at all, but rather it gives you the tools to build something like that yourself with it.

Usage

react-crop-selector can be found on npm:

npm install --save react-crop-selector

protip: npm install --save === npm i -S

Once installed, you can use it like so:

import React from 'react';
import CropSelector from 'react-crop-selector';

export default function MyComponent() {
    return (
        <CropSelector
            width={640} height={480}
            x1={5} y1={5} x2={95} y2={95}
        />
    );
}

react-crop-selector uses css-modules so your build system will need to be able to handle those.

API

PropTypeDescription
widthNumberwidth of the cropper. Required.
heightNumberheight of the cropper. Required.
x1Numberx-coord (as a percentage) of top left corner of the crop. Defaults to 0.
y1Numbery-coord (as a percentage) of top left corner of the crop. Defaults to 0.
x2Numberx-coord (as a percentage) of bottom right corner of the crop. Defaults to 100.
y2Numbery-coord (as a percentage) of bottom right corner of the crop. Defaults to 100.
minWidthNumberminimum width (as a percentage) of the cropped area
minHeightNumberminimum width (as a percentage) of the cropped area
ratioStringaspect ratio to lock to defined as width:height, e.g. 4:3
guideStringcreate guide lines inside the crop area, currently only supports rule-of-thirds
onChangeFunctioncalled when the crop changes. Receives x1, y1, x2 and y2 (as percentages) as its arguments.

License

MIT © Poki BV

FAQs

Package last updated on 16 Feb 2018

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