Constructor
# new Image(config)
Its a Custom Web Component. Do not use the constructor directly with the new keyword. Instead, use one of the 3 following methods:
Create the Web Component and call its init method:
const myImage = document.createElement("a-image").init(config)
Or use the shorthand for it:
const myImage = createImage({
src: "./logo.png",
alt: "Company logo"
})
myImage.render()
Or directly declare the config inside a container component:
const myPanel = createPanel({
title: "My panel",
items: [
{
type: "image",
src: "./logo.png",
alt: "Company logo"
}
]
})
myPanel.render()
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
config |
object
|
||
src |
string
|
||
alt |
string
|
<optional> |
|
objectFit |
string
|
<optional> |
fill (default) | contain | cover | scale-down | none |
position |
string
|
<optional> |
|
top |
string
|
<optional> |
|
left |
string
|
<optional> |
|
right |
string
|
<optional> |
|
float |
string
|
<optional> |
|
display |
string
|
<optional> |
|
width |
string
|
number
|
<optional> |
|
height |
string
|
number
|
<optional> |
|
margin |
string
|
<optional> |
|
padding |
string
|
<optional> |
|
border |
string
|
<optional> |
|
borderStyle |
string
|
<optional> |
|
borderWidth |
string
|
<optional> |
|
borderColor |
string
|
<optional> |
|
borderRadius |
string
|
<optional> |
|
boxShadow |
string
|
<optional> |
|
zIndex |
number
|
<optional> |
|
draggable |
boolean
|
<optional> |
|
cursor |
string
|
<optional> |
this
Generated markup
<a-image class="a-image">
<img class="image-content">
</a-image>