BlogPlaygroundOne

VImg API


Props
name
type
default
boolean
false

Applies position: absolute to the component.

string
undefined

Alternate text for screen readers. Leave empty for decorative images.

string | number
undefined

Calculated as width/height, so for a 1920x1080px image this will be 1.7778. Will be calculated automatically if omitted.

string
undefined

Applies specified color to the control - supports utility colors with or without text- prefix (for example success, purple or text-purple) or CSS color (#033 or rgba(255, 0, 0, 0.5)). Find a list of built-in classes on the colors page.

any
undefined

Apply a custom class to the internal content element.

boolean
false

Resizes the background image to cover the entire container.

'' | 'anonymous' | 'use-credentials'
undefined

Specify that images should be fetched with CORS enabled MDN

boolean | 'true' | 'false'
undefined

Controls the draggable behavior of the image. See MDN.

boolean
false

Forces the component’s content to render when it mounts. This is useful if you have content that will not be rendered in the DOM that you want crawled for SEO.

string
undefined

The gradient to apply to the image. Only supports linear-gradient syntax, anything else should be done with classes.

string | number
undefined

Sets the height for the component.

any
undefined

Applies CSS classes to the inner <img> element.

boolean
false

Display as an inline element instead of a block, also disables flex-grow.

string
undefined

Something to show while waiting for the main image to load, typically a small base64-encoded thumbnail. Has a slight blur filter applied.
NOTE: This prop has no effect unless either height or aspect-ratio are provided.

string | number
undefined

Sets the maximum height for the component.

string | number
undefined

Sets the maximum width for the component.

string | number
undefined

Sets the minimum height for the component.

string | number
undefined

Sets the minimum width for the component.

IntersectionObserverInit
{
  root: undefined,
  rootMargin: undefined,
  threshold: undefined
}

Options that are passed to the Intersection observer constructor.

string
undefined

Applies object-position styles to the image and placeholder elements.

  | 'origin'
  | 'no-referrer'
  | 'no-referrer-when-downgrade'
  | 'origin-when-cross-origin'
  | 'same-origin'
  | 'strict-origin'
  | 'strict-origin-when-cross-origin'
  | 'unsafe-url'
undefined

Define which referrer is sent when fetching the resource MDN

string | number | boolean
undefined

Designates the border-radius applied to the component. This can be 0, xs, sm, true, lg, xl, pill, circle, and shaped. Find more information on available border radius classes on the Border Radius page.

string
undefined

For use with srcset, see MDN.

  | string
  | { src: string; srcset: string; lazySrc: string; aspect: number }

The image URL. This prop is mandatory.

string
undefined

A set of alternate images to use based on device size. Read more….

boolean
false

Removes any applied border-radius from the component.

string | boolean | (TransitionProps & { component: Component })
'fade-transition'

The transition to use when switching from lazy-src to src. Can be one of the built in or custom transition.

string | number
undefined

Sets the width for the component.

Events
name
type
[string]

Emitted if the image fails to load.

[string]

Emitted when the image is loaded.

[string]

Emitted when the image starts to load.

Slots
never
never
never
never

The default Vue slot.

Will be shown if the image fails to load, replacing the placeholder slot.

Display an overlay while the image is loading.

A list of <source> elements. If this slot is used v-img will render a <picture> instead of <img>.

Exposed
string
HTMLImageElement
number
number
'error' | 'loading' | 'idle' | 'loaded'

The current source of the image. This is the image that is currently being displayed. This is useful for determining if the image is loading or not.

The image element.

The natural height of the image.

The natural width of the image.

The current state of the image. This is useful for determining if the image is loading or not.

SASS Variables
name
default
200px
blur(4px)
settings.$border-radius-root