Skip to content

kenphil/antd-img-crop

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

antd-img-crop

An image cropper for Ant Design Upload.

npm npm npm bundle size GitHub

English | 简体中文

Demo

Edit antd-img-crop

Install

yarn add antd-img-crop

Usage

import ImgCrop from 'antd-img-crop';
import { Upload } from 'antd';

const Demo = () => (
  <ImgCrop>
    <Upload>+ Add image</Upload>
  </ImgCrop>
);

Props

Name Type Default Description
width number 100 Width of cropped image in px.
height number 100 Height of cropped image in px.
contain boolean false Consistent with background-size: contain, crop area will fill the width or height.
useRatio - - Deprecated, please use contain.
resize boolean true If crop area can resize.
resizeAndDrag boolean true If crop area can resize and drag.
modalTitle string "Edit image" Title of modal.
modalWidth number 520 Width of modal in px.
beforeCrop function - Execute before crop, modal will not open if return false (Not support Promise). beforeUpload prop of Upload will execute after crop, before upload.

License

MIT License (c) nanxiaobei

About

🔪 An image cropper for Ant Design Upload

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 97.6%
  • CSS 2.4%