Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

42-antd-img-crop

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

42-antd-img-crop

An image cropper for Ant Design Upload

  • 4.12.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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 adjustment
rotationSliderbooleanfalseEnable rotation adjustment
aspectSliderbooleanfalseEnable aspect adjustment
showResetbooleanfalseShow reset button to reset zoom rotation aspect
resetTextstringResetReset button text
aspectnumber1 / 1Aspect of crop area , width / height
minZoomnumber1Minimum zoom factor
maxZoomnumber3Maximum zoom factor
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-Ok button callback
onModalCancelfunction-Cancel button, modal mask, top right "x" callback
modalPropsobjectAnt Design Modal props (* existing props cannot be overridden)
beforeCropfunction-Upload button callback, 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

FUTAKE

Try FUTAKE in WeChat. A mini app for your inspiration moments. 🌈

Keywords

FAQs

Package last updated on 27 Jun 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc