Images
Aspect ratio
This component is deprecated.
We recommend using native aspect-ratio
To help create consistent page layouts, use one of the ratios provided for images and image containers.
Example
Behaviour
- Improve page performance by setting
to false. This defers loading the image until required.[preload] - Images can be displayed by either
or placing a nativeimageUrl tag within theimg .tg-aspect-ratio - Aspect ratio scales and crops an image based on the CSS attribute
.background-size:cover - 4:3 is the most common ratio uploaded by members.
- An
tag is used when using a screen-reader. It should describe the content of an image. In some cases an alt tag might not be appropriate. e.g decorative images.alt - Content can sit inside of Aspect ratio. Content does not affect the height of the container, it is absolutely positioned on top of the background content.
Image
The Image component uses a native image element and modern css to provide consistent aspect ratios for resized images, and support for lazy loading.
Example
Behaviour
- Improve page performance should benefit as the default
is set to lazy to false. Lazy loading defers the loading of resources on the page as long as they are not needed[loading] - Images are scaled to display the whole image. By changing
to[objectFit] it will zoom in the image to fill the available space.[fill] - ObjectFit is not supported for IE.
Circle image
Creates round images, commonly used for member avatars. When circle image is placed on a link, drop shadows are applied so it appears on the action layer.
Example

Expanding image
This component is deprecated.
We recommend using native aspect-ratioloading='lazy'
Expanding image enlarges an image until it meets the height or width of its container. The parent container must be relative or absolute in order for the expanding image to be visible.
Example
Image viewer
Image viewer provides controls to browse through images one item at a time. It is often used inside other components such as cards or modals.
Example
Behaviour
To lazy load images as they become visible, use aspect ratio inside image viewer.
SVG
Scalable Vector Graphics (SVGs) are used for vector based images, such as illustrations and logos. Use tg-svg
Usage
- SVGs must be set up as a component. Using a
template, create a file that contains the SVG code. The component is used inside*.component.html .tg-svgNote: You will need to import into the SVG component module, and the module that imports the SVG.TgSvgModule - Always minify your source SVG before adding to the component.
- Consider using Angular templating features to control your SVG. For example:
- You may have a logo that can be white or coloured. Give your SVG component an
to manage the colour or use a class if the SVG is not dynamic.@Input() - You may have an illustration that changes at different breakpoints. Combine your SVGs, and use
to show and hide different elements.*ngIf
- You may have a logo that can be white or coloured. Give your SVG component an
Example
Dynamic SVG content
To dynamically change SVG content at run-time, consider using the [component]entryComponentsNgModule