# react-cropper
**Repository Path**: mirrors_fis-components/react-cropper
## Basic Information
- **Project Name**: react-cropper
- **Description**: Fork from https://github.com/roadmanfong/react-cropper.git
- **Primary Language**: Unknown
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-08-08
- **Last Updated**: 2026-01-10
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# react-cropper
[Cropperjs](https://github.com/fengyuanchen/cropperjs) as React components
[](https://www.npmjs.com/package/react-cropper)
[Demo](http://roadmanfong.github.io/react-cropper/example/)
## Docs
* [Image Cropper](https://github.com/fengyuanchen/cropper)
## Installation
Install via [npm](https://www.npmjs.com/package/react-cropper)
```shell
npm install --save react-cropper
```
### Webpack User
You also need a couple of loaders for webpack
```shell
npm install style-loader css-loader
```
### Browserify User
https://github.com/cheton/browserify-css
```shell
npm i --save-dev browserify-css
```
Compile your project with command line like
```shell
browserify -t reactify -g browserify-css index.jsx > bundle.js
```
If you are using `gulp`, `browserify` or other build tools, make sure you enable `global` option `true`
For example in `gulp` you should do
```js
b.transform(browserifycss, {global: true});
```
## Todo
* Unit test
## Quick Example
```js
var Cropper = require('react-cropper');
var Demo = React.createClass({
_crop: function(){
// image in dataUrl
console.log(this.refs.cropper.getCroppedCanvas().toDataURL());
},
render: function() {
return (
);
}
});
```
## Options
### src
* Type: `string`
* Default: `null`
```js
```
### Other options
Accept all options in the [docs](https://github.com/fengyuanchen/cropper#options) as attributes.
```js
```
## Methods
Assign a `ref` attribute to use [methods](https://github.com/fengyuanchen/cropper#methods)
```js
var Demo = React.createClass({
_crop: function(){
var dataUrl = this.refs.cropper.getCroppedCanvas().toDataURL();
console.log(dataUrl);
},
render: function() {
return (
);
}
})
```
## Build
```
npm run build
```
## Author
Fong Kuanghuei(fongkuanghui@gmail.com)
## License
MIT