Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@wix/image

Package Overview
Dependencies
Maintainers
27
Versions
323
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wix/image

Wix base image component

  • 1.333.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
27
Created
Source

Image

One Image to rule them all.

... and in the darkness register the custom element and load them.

Example

import { Image } from '@wix/image';

function Example() {
  return <Image {...props} />
}

Installation

Install package

You can install the package via npm/yarn

> npm install -s @wix/image --registry http://npm.dev.wixpress.com/

or:

> yarn add @wix/image --registry http://npm.dev.wixpress.com/

Props

Prop nameTypeDefaultDescription
idstring-System generated id
containerIdstring-Parent container id
uristring-Original image URI
altstring-Alternate text
namestring''Name of the image, used for generating a pretty URL
rolestring-Role
widthnumber-Width of the original source image
heightnumber-Height of the original source image
displayModestring-Method to use for fitting the image into its container (like CSS's object-fit property) : fill | fit | stretch
devicePixelRationumber-Force a pixel-ratio to use for loading the image. Defaults to DPR of the device and using 2 as max
qualityobject-Image quality : quality: number ; unsharpMask: {radius: any;amount: any; threshold: any;}
alignTypestring-Alignment of the image. To note: if the image is larger than the container and the display mode is not set to fit or stretch, the alignment will refer to the container's position on the image. Otherwise, it will refer to the position of the image within the container. Options: center | top | top_left | top_right | left | right | bottom | bottom_left | bottom_right
bgEffectNamestring''name of background scroll effect
focalPointobject-Image focal point (0 - 100). Relevant only if displayMode is set to fill, actual_size and original_size {x: number; y: number}
upscaleMethodstring-auto | classic | super
classNamestring''Additional class names
cropobject-Image crop (x & y are coordinates of the pixel to start cropping from). Flip and rotate parameters are relevant only if svgId is provided. { x: number; y: number; width: number; height: number; svgId?: string; flip?: 'vertical' | 'horizontal' | 'both' | 'none'; rotate?: number;}
imageStylesobject{}Inline styling
targetWidthnumber-Override for the rendered image element's width
targetHeightnumber-Override for the rendered image element's height
containerWidthnumber-Width in pixels of the container element
containerHeightnumber-Height in pixels of the container element
onLoadfunction() => {}Image's onLoad callback
onErrorfunction() => {}Image's onError callback
shouldUseLQIPboolean-Indicates whether component should use a low quality placeholder before loading the final high-quality image'
getPlaceholderfunction-function that returns placeholder uri and styling (if undefined and shouldUseLQIP true, the component will default to use getPlaceholder from the @imageKit)
isInFirstFoldboolean-If true, render high quality image in SSR (currently only supported for images with known fixed size)
placeholderTransitionstring'blur'Method of transition to use between placeholder and final image
socialAttrsobject-{'data-pin-nopin'?: boolean; 'data-pin-url'?: string; 'data-pin-media'?: string;}
isSEOBotboolean-If true, render high quality image for indexing robots
skipMeasurebooleanfalseIf true, the measurement for the image will be skipped and given dimensions will be used instead.
hasAnimationbooleanfalseIs the image an animated webp.

FAQs

Package last updated on 11 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc