Skip to content

Zurich image - Web Component

Browser support

Detected engine:  

  • Chromium

  • Webkit

  • Gecko

Parameters

The Web component uses the <z-zurich-image> tag:

The parametrization of the component can be done with the following custom HTML params:

NameTypeDescriptionSlot
imagestringThe name of the image we want to display
image-alt
(optional)
stringThe alt text for the image
width
(optional)
numberThe width of the image
height
(optional)
numberThe height of the image
frame
(optional)
number[]Attribute used to crop the image
position
(optional)
number[]Attribute used to position the image
background
(optional)
stringThe background color of the image
quality
(optional)
numberThe quality of the image
rotate
(optional)
numberThe rotation of the image

image

The attribute image is a string that represents the name to the image that will be displayed.

Make sure to use the correct name of the image you want to display. Check the Zurich media images

image-alt

The attribute image-alt is a string that represents the alt text to the image that will be displayed.

width & height

The attributes width and height are numbers that represent the width and height of the image, respectively.

Using the width and height attributes, the image will maintain the aspect ratio. Filling the space available with a background color. Check the background attribute to change the color.

frame

The attribute frame is used to crop the image. The first value is the x position and the second value is the y position.

If the frame attribute is set, the width and height attributes will be ignored.

position

The attribute position is used to define the position of the iframe. The first value is the x position and the second value is the y position.

background

The attribute background is a string that represents the background color of the image. The default value is grey.

quality

The attribute quality is a number that represents the image. If not specified the image will be displayed in the maximum 100% quality. The values can be from 0 to 100.

INFO

If the device rendering the image has a retina display, the image will automatically be displayed in the best quality, increasing the DPI.

rotate

The attribute rotate is a number that represents the rotation of the image. The possible values are: 0, 90, 180 and 270.

Playground

Customization

HTML Examples

Imports
html
<link rel="stylesheet" href="/0.5.2/@zurich/web-components/styles.css" />
<script type="module" src="/0.5.2/@zurich/web-components/zurich-image.js"></script>
Code
html
<z-zurich-image image="polar_bear" width="300"></z-zurich-image>