Code Monkey home page Code Monkey logo

image's Introduction

rc-image

React Image.

NPM version dumi build status Test coverage npm download bundle size

Feature

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

install

rc-image

Usage

npm install
npm start
import Image from 'rc-image';

export default () => (
  <Image src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" />
);

API

Name Type Default Description
preview boolean | { visible: boolean, scaleStep: number, onVisibleChange: function(value, prevValue), getContainer: string | HTMLElement | (() => HTMLElement) | false } true Whether to show preview
prefixCls string rc-image Classname prefix
placeholder boolean | ReactElement - if true will set default placeholder or use ReactElement set customize placeholder
fallback string - Load failed src
previewPrefixCls string rc-image-preview Preview classname prefix
onError (event: Event) => void - Load failed callback

Image.PreviewGroup

preview the merged src

import Image from 'rc-image';

export default () => (
  <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>
);

API

Name Type Default Description
preview boolean |
{ visible: boolean, scaleStep: number, onVisibleChange: function(value, prevValue), getContainer: string | HTMLElement | (() => HTMLElement) | false, countRender?: (current: number, total: number) => string, current: number }
true Whether to show preview,
current: If Preview the show img index, default 0
previewPrefixCls string rc-image-preview Preview classname prefix
icons { [iconKey]?: ReactNode } - Icons in the top operation bar, iconKey: 'rotateLeft' | 'rotateRight' | 'zoomIn' | 'zoomOut' | 'close' | 'left' | 'right'

Example

http://localhost:8003/examples/

Test Case

npm test

Coverage

npm run coverage

License

rc-image is released under the MIT license.

image's People

Contributors

afc163 avatar amiralitaheri avatar coldice8 avatar dependabot-preview[bot] avatar dependabot[bot] avatar eng-cc avatar harupy avatar heiyu4585 avatar hengkx avatar huangkairan avatar imgbot[bot] avatar jarvisart avatar jueinin avatar kiner-tang avatar kkaaddff avatar li-jia-nan avatar madccc avatar omrigm avatar rfreling avatar shaodahong avatar simonwong avatar u3u avatar wangjunjia avatar xch1029 avatar xrkffgg avatar xz8la8 avatar ycjcl868 avatar yoghurtxu avatar zombiej avatar zpc7 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.