Image
Image, with a standard or a custom aspect ratio.
Props
- src (string):
src
HTML attribute to set to the element. - alt (string):
alt
HTML attribute to set to the element. - ratio (string): Aspect ratio to apply to the image.
- [OPTIONAL] id (string):
id
HTML attribute to set to the element. - [OPTIONAL] lazy (boolean):
lazy
HTML attribute to set to the element. - [OPTIONAL] modifiers (string): List of modifiers to apply to the element. Defaults to
""
. - [OPTIONAL] itemProp (string):
itemprop
HTML attribute to set to the element.
Syntax - square ratio
- React
- Vue
- Svelte
- HTML
<UIImage
id="my-id"
alt="illustration"
src="/src/image.jpg"
ratio="square"
modifiers="large"
itemProp="illustration"
/>
<UIImage
id="my-id"
alt="illustration"
src="/src/image.jpg"
ratio="square"
modifiers="large"
item-prop="illustration"
/>
<UIImage
id="my-id"
alt="illustration"
src="/src/image.jpg"
ratio="square"
modifiers="large"
itemProp="illustration"
/>
<div id="my-id" class="ui-image ui-image--square--large">
<img
alt="illustration"
height="1"
loading="lazy"
src="/src/image.jpg"
width="1"
itemprop="illustration"
/>
</div>
Syntax - portrait ratio
- React
- Vue
- Svelte
- HTML
<UIImage
alt="illustration"
src="/src/image.jpg"
ratio="portrait"
/>
<UIImage
alt="illustration"
src="/src/image.jpg"
ratio="portrait"
/>
<UIImage
alt="illustration"
src="/src/image.jpg"
ratio="portrait"
/>
<div class="ui-image ui-image--portrait">
<img
alt="illustration"
height="3"
loading="lazy"
src="/src/image.jpg"
width="2"
/>
</div>
Syntax - landscape ratio
- React
- Vue
- Svelte
- HTML
<UIImage
alt="illustration"
src="/src/image.jpg"
ratio="landscape"
/>
<UIImage
alt="illustration"
src="/src/image.jpg"
ratio="landscape"
/>
<UIImage
alt="illustration"
src="/src/image.jpg"
ratio="landscape"
/>
<div class="ui-image ui-image--landscape">
<img
alt="illustration"
height="2"
loading="lazy"
src="/src/image.jpg"
width="3"
/>
</div>
Syntax - panoramic ratio
- React
- Vue
- Svelte
- HTML
<UIImage
alt="illustration"
src="/src/image.jpg"
ratio="panoramic"
/>
<UIImage
alt="illustration"
src="/src/image.jpg"
ratio="panoramic"
/>
<UIImage
alt="illustration"
src="/src/image.jpg"
ratio="panoramic"
/>
<div class="ui-image ui-image--panoramic">
<img
alt="illustration"
height="9"
loading="lazy"
src="/src/image.jpg"
width="16"
/>
</div>
Syntax - no lazy
- React
- Vue
- Svelte
- HTML
<UIImage
alt="illustration"
src="/src/image.jpg"
ratio="panoramic"
lazy={false}
/>
<UIImage
alt="illustration"
src="/src/image.jpg"
ratio="panoramic"
lazy={false}
/>
<UIImage
alt="illustration"
src="/src/image.jpg"
ratio="panoramic"
lazy={false}
/>
<div class="ui-image ui-image--panoramic">
<img
alt="illustration"
height="9"
src="/src/image.jpg"
width="16"
/>
</div>
Syntax - custom ratio
- React
- Vue
- Svelte
- HTML
<UIImage
alt="illustration"
src="/src/image.jpg"
ratio="256x525"
/>
<UIImage
alt="illustration"
src="/src/image.jpg"
ratio="256x525"
/>
<UIImage
alt="illustration"
src="/src/image.jpg"
ratio="256x525"
/>
<img
class="ui-image ui-image--256x525"
alt="illustration"
height="525"
loading="lazy"
src="/src/image.jpg"
width="256"
/>