README.md 3.23 KB

rc-image


React Image.

NPM version CircleCI status Test coverage Dependencies DevDependencies npm download bundle size

Feature

  • Placeholder
  • Preview
  • Rotate
  • Zoom
  • Fallback
  • Multiple Preview

Keyboard

install

rc-image

Usage

npm install
npm start
const Image = require('rc-image');

ReactDOM.render(
  <Image src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" />
), document.getElementById('root'));

API

Name Type Default Description
preview boolean \ {visible: boolean,onVisibleChange:function(value, prevValue),getContainer: string \ HTMLElement \
prefixCls string rc-image Classname prefix
placeholder boolean \ ReactElement -
fallback string - Load failed src
previewPrefixCls string rc-image-preview Preview classname prefix

Image.PreviewGroup

preview the merged src

const Image = require('rc-image');

ReactDOM.render(
  <Image.PreviewGroup>
    <Image src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" />
    <Image src="https://gw.alipayobjects.com/mdn/rms_08e378/afts/img/A*P0S-QIRUbsUAAAAAAAAAAABkARQnAQ" />
  </Image.PreviewGroup>
), document.getElementById('root'));

Example

http://localhost:8003/examples/

Test Case

npm test

Coverage

npm run coverage

License

rc-image is released under the MIT license.