React Image Component

Image

React image component with responsive behavior (so it's never become larger than their parent element) and special styles.

Other frameworks

CoreUI components are available as native Angular, Bootstrap (Vanilla JS), and Vue components. To learn more please visit the following pages.

Responsive images#

Images in CoreUI for React.js are made responsive with fluid property. This applies max-width: 100%; and height: auto; to the image so that it scales with the parent element.

<CImage fluid src="/images/react.jpg" />

Image thumbnails#

In addition to our border-radius utilities, you can use propthumbnail to give an image a rounded 1px border appearance.

<CImage rounded thumbnail src="/images/react400.jpg" width={200} height={200} />

Aligning images#

Align images with the align property.

<div className="clearfix">
<CImage align="start" rounded src="/images/react400.jpg" width={200} height={200} />
<CImage align="end" rounded src="/images/react400.jpg" width={200} height={200} />
</div>
<div className="clearfix">
<CImage align="center" rounded src="/images/react400.jpg" width={200} height={200} />
</div>
<div className="text-center">
<CImage rounded src="/images/react400.jpg" width={200} height={200} />
</div>

API#

CImage#

import { CImage } from '@coreui/react'
// or
import CImage from '@coreui/react/src/components/image/CImage'
PropertyDescriptionTypeDefault
alignSet the horizontal aligment.'start' | 'center' | 'end'-
classNameA string of all className you want applied to the component.string-
fluidMake image responsive.boolean-
roundedMake image rounded.boolean-
thumbnailGive an image a rounded 1px border appearance.boolean-