Gathering detailed insights and metrics for react-avatar-edit
Gathering detailed insights and metrics for react-avatar-edit
Gathering detailed insights and metrics for react-avatar-edit
Gathering detailed insights and metrics for react-avatar-edit
react-avatar-editor
Avatar / profile picture component. Resize and crop your uploaded image using a intuitive user interface.
@types/react-avatar-editor
TypeScript definitions for react-avatar-editor
@mikhail2404/react-avatar-edit
ReactJS component to upload, crop, and preview avatars
@impargo/react-avatar-edit
ReactJS component to upload, crop, and preview avatars
npm install react-avatar-edit
Typescript
Module System
Node Version
NPM Version
JavaScript (98.29%)
HTML (1.71%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
565 Stars
154 Commits
102 Forks
8 Watchers
5 Branches
18 Contributors
Updated on Jul 10, 2025
Latest Version
1.2.0
Package Id
react-avatar-edit@1.2.0
Unpacked Size
219.67 kB
Size
95.77 kB
File Count
9
NPM Version
8.5.5
Node Version
17.8.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
3
1
👤 Load, crop and preview avatar with ReactJS component
npm i react-avatar-edit
1import React from 'react' 2import ReactDOM from 'react-dom' 3import Avatar from 'react-avatar-edit' 4 5class App extends React.Component { 6 7 constructor(props) { 8 super(props) 9 const src = './example/einshtein.jpg' 10 this.state = { 11 preview: null, 12 src 13 } 14 this.onCrop = this.onCrop.bind(this) 15 this.onClose = this.onClose.bind(this) 16 this.onBeforeFileLoad = this.onBeforeFileLoad.bind(this) 17 } 18 19 onClose() { 20 this.setState({preview: null}) 21 } 22 23 onCrop(preview) { 24 this.setState({preview}) 25 } 26 27 onBeforeFileLoad(elem) { 28 if(elem.target.files[0].size > 71680){ 29 alert("File is too big!"); 30 elem.target.value = ""; 31 }; 32 } 33 34 render () { 35 return ( 36 <div> 37 <Avatar 38 width={390} 39 height={295} 40 onCrop={this.onCrop} 41 onClose={this.onClose} 42 onBeforeFileLoad={this.onBeforeFileLoad} 43 src={this.state.src} 44 /> 45 <img src={this.state.preview} alt="Preview" /> 46 </div> 47 ) 48 } 49} 50 51ReactDOM.render(<App /> , document.getElementById('root'))
Prop | Type | Description |
---|---|---|
img | Image | The Image object to display |
src | String/Base64 | The url to base64 string to load (use urls from your domain to prevent security errors) |
width | Number | The width of the editor |
height | Number | The height of the editor (image will fit to this height if neither imageHeight, nor imageWidth is set) |
imageWidth | Number | The desired width of the image, can not be used together with imageHeight |
imageHeight | Number | The desired height of the image, can not be used together with imageWidth |
cropRadius | Number | The crop area radius in px (default: calculated as min image with/height / 3) |
cropColor | String | The crop border color (default: white) |
lineWidth | Number | The crop border width (default: 4) |
minCropRadius | Number | The min crop area radius in px (default: 30) |
backgroundColor | String | The color of the image background (default: white) |
closeIconColor | String | The close button color (default: white) |
shadingColor | String | The shading color (default: grey) |
shadingOpacity | Number | The shading area opacity (default: 0.6) |
mimeTypes | String | The mime types used to filter loaded files (default: image/jpeg,image/png) |
label | String | Label text (default: Choose a file) |
labelStyle | Object | The style object for preview label (use camel case for css properties fore example: fontSize) |
borderStyle | Object | The style for object border preview (use camel case for css properties fore example: fontSize) |
onImageLoad(image) | Function | Invoked when image based on src prop finish loading |
onCrop(image) | Function | Invoked when user drag&drop event stop and return cropped image in base64 string |
onBeforeFileLoad(file) | Function | Invoked when user before upload file with internal file loader (etc. check file size) |
onFileLoad(file) | Function | Invoked when user upload file with internal file loader |
onClose() | Function | Invoked when user clicks on close editor button |
exportAsSquare | Boolean | The exported image is a square and the circle is not cut-off from the image |
exportSize | Number | The size the exported image should have (width and height equal). The cropping will be made on the original image to ensure a high quality. |
exportMimeType | String | The mime type that should be used to export the image, supported are: image/jpeg, image/png (Default: image/png) |
exportQuality | Number | The quality that should be used when exporting in image/jpeg. A value between 0.0 and 1.0. |
npm run start
npm run build
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 8/19 approved changesets -- score normalized to 4
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
33 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More