Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

🗡 An image cropper for Ant Design Upload

License

NotificationsYou must be signed in to change notification settings

nanxiaobei/antd-img-crop

Repository files navigation


antd-img-crop

An image cropper for Ant DesignUpload

npmnpmnpm bundle sizeGitHubnpm type definitions

English |简体中文

Demo

Edit antd-img-crop

Install

pnpm add antd-img-crop# oryarn add antd-img-crop# ornpm i antd-img-crop

Usage

import{Upload}from'antd';importImgCropfrom'antd-img-crop';constDemo=()=>(<ImgCrop><Upload>+ Add image</Upload></ImgCrop>);

Props

PropTypeDefaultDescription
qualitynumber0.4Cropped image quality,0 to1
fillColorstring'white'Fill color for cropped image
zoomSliderbooleantrueEnable zoom
rotationSliderbooleanfalseEnable rotation
aspectSliderbooleanfalseEnable aspect
showResetbooleanfalseShow reset button to reset zoom & rotation & aspect
resetTextstringResetReset button text
aspectnumber1 / 1Aspect of crop area ,width / height
minZoomnumber1Minimum zoom
maxZoomnumber3Maximum zoom
minAspectnumber0.5Minimum aspect
maxAspectnumber2Maximum aspect
cropShapestring'rect'Shape of crop area,'rect' or'round'
showGridbooleanfalseShow grid of crop area (third-lines)
cropperPropsobject-react-easy-crop props (* existing props cannot be overridden)
modalClassNamestring''Modal classname
modalTitlestring'Edit image'Modal title
modalWidthnumberstringModal width
modalOkstringOk button text
modalCancelstringCancel button text
onModalOkfunction-Callback of click ok button
onModalCancelfunction-Callback of click cancel button (or modal mask & top right "x")
modalPropsobjectAnt Design Modal props (* existing props cannot be overridden)
beforeCropfunction-Callback before crop modal, if returnfalse orreject(), modal will not open

FAQ

ConfigProvider not work?

Try to setlibraryDirectory('es' or'lib') tobabel-plugin-import config, see which one will work.

module.exports={plugins:[['import',{libraryName:'antd',libraryDirectory:'es',style:true}],],};

No style? (onlyantd<=v4)

If you useantd<=v4 +babel-plugin-import, and noModal orSlider were imported, please import these styles manually:

import'antd/es/modal/style';import'antd/es/slider/style';

License

MIT License (c)nanxiaobei

About

🗡 An image cropper for Ant Design Upload

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors18


[8]ページ先頭

©2009-2025 Movatter.jp