QImg

The QImg component makes working with images (any picture format) easy and also adds a nice loading effect to it along with many other features (example: the ability to set an aspect ratio).

Installation

/*
 * No installation step is necessary.
 * It gets installed by default by @quasar/app v2+.
 */

Usage

Basic

Basic

Aspect ratio

Custom aspect ratio

Captions

Captions

Image style

In the example below, we add a blur and sepia effect. Furthermore, we make use of the rounded-borders CSS helper class.

Custom image style

Contain mode

Contain mode (example below) will force-show the whole image, which usually leads to empty space (horizontally or vertically) besides the image. The second image doesn’t uses the contain mode and it’s there for comparison purposes.

Contain mode

Transitions

Use the basic property which disables transitions (and it also renders the component faster):

Transitions

Loading states

Loading state

When you have big-sized images, you can use a placeholder image (recommended to be specified in base64 encoding) like in the example below. The placeholder will be displayed until the target image gets loaded. We’re toggling the QImg tag so you can see the placeholder image in action.

Placeholder source
Error state

Responsive

WARNING

To grasp the sizes and srcset properties, please read about native support on responsive images because QImg relies on that entirely.

Responsive

TIP

For sizes property, please read about Resolution Switching: Different Sizes.

TIP

For srcset property, please read about Resolution Switching: Same size, different resolutions.

Native context menu

In the example below we enable native context menu on the images.

WARNING

When you are using this option always take care to have the content of the default or error slots wrapped in a div element, or add a all-pointer-events class on the element.

Native context menu

QImg API

Loading API...
Please wait...