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

antd-img-crop

Package Overview
Dependencies
Maintainers
0
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

antd-img-crop

An image cropper for Ant Design Upload

4.24.0
latest
Source
npm
Version published
Weekly downloads
79K
2.36%
Maintainers
0
Weekly downloads
 
Created
Source

Link in bio to widgets, your online home screen. ➫ 🔗 kee.so

antd-img-crop

An image cropper for Ant Design Upload

npm npm npm bundle size GitHub npm type definitions

English | 简体中文

Install

pnpm add antd-img-crop
# or
yarn add antd-img-crop
# or
npm i antd-img-crop

Usage

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

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

Edit antd-img-crop

Props

PropTypeDefaultDescription
qualitynumber0.4Cropped image quality, 0 to 1
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 return false or reject(), modal will not open

FAQ

ConfigProvider not work?

Try to set libraryDirectory('es' or 'lib') to babel-plugin-import config, see which one will work.

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

No style? (only antd<=v4)

If you use antd<=v4 + babel-plugin-import, and no Modal or Slider were imported, please import these styles manually:

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

License

MIT License (c) nanxiaobei

Keywords

react

FAQs

Package last updated on 20 Dec 2024

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