Image
WARNING
This component is still under development. It is not yet available in releases of Codex.
An Image is a visual element used to display content in various formats and states, supporting features like aspect ratios, placeholders, and responsive sizing.
Guidelines
When to use images
Use the Image component to display visual content like photos or illustrations that enhance context and meaning. Ideal for adding visual elements in layouts, supporting text content, or embedding in components like cards and dialogs. Avoid using for purely decorative purposes or stylized visual elements. Always include meaningful alt
text for accessibility.
Demos
Configurable
Name | Value |
---|---|
Props | |
src | |
alt | |
aspectRatio | |
objectFit | |
objectPosition | |
position | |
width | |
height | |
View | |
Reading direction |
Default
Name | Value |
---|---|
View | |
Reading direction |
Aspect Ratio
Name | Value |
---|---|
View | |
Reading direction |
Placeholder
Name | Value |
---|---|
View | |
Reading direction |
Error
Name | Value |
---|---|
View | |
Reading direction |
Vue usage
Props
Prop name | Description | Type | Values | Default |
---|---|---|---|---|
src | The source URL of the image. | string | - | '' |
alt (required) | Alternative text for the image. Descriptive text must be provided unless the image is decorative or described elsewhere. | string | - | '' |
aspectRatio | The aspect ratio of the image. Accepts one of the predefined aspect ratios. | ImageAspectRatio | - | null |
objectPosition | The object-position of the image when cropping with an aspect ratio. Accepts 'top', 'bottom', 'left', 'right', or 'center'. | typeof ObjectPositions[number] | - | 'center' |
objectFit | Specifies how the image should be resized to fit its container. Accepts 'fill', 'contain', 'cover', 'none', or 'scale-down'. | typeof ObjectFitOptions[number] | - | 'cover' |
position | Image position on a page | string | left , center , right | '' |
width | The width of the image in pixels. | string|number | - | undefined |
height | The height of the image in pixels. | string|number | - | undefined |
loadingPriority | The loading priority of the image. Accepts 'lazy' or 'eager'. | string | lazy , eager | 'lazy' |
Events
Event name | Properties | Description |
---|---|---|
error | event Event - The error event object. | Emitted when an error occurs loading the image. |