<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-5HGSQD2L" height="0" width="0" style="display:none;visibility:hidden" title="GTM"></iframe>

Convenience Elements

Convenience Elements provide a wrapper component for many commonly used HTML tags like p, h1-h6, img, section and span. These convenience elements enable use of the system's core props (`margin`, `padding`, `fontWeight`, etc), and are optional.

Convenience Elements provide a wrapper component for many commonly used HTML tags (like p, h1-h6, img, section, and span), enabling convenience props like `margin`, `padding`, and `fontWeight`.

Components like Img are wrappers around other components, letting you specify which of a number of related components you want to use.

For example, if you want to render an image as a progressive or a responsive image, you don't need to use the specific component ProgressiveImage or ResponsiveImage. Instead, you can simply use Img with a variant prop that indicates either progressive or responsive.

These convenience components enable SWAN standards and functionality, and are built for extensibility.


Headings

The preview has been updated.


Img

The Img component provides an image, in one of these types:

As Fluid Image (the default behaviour)

More details can be found at Fluid Image

The preview has been updated.

As Responsive Image

More details can be found at Responsive Image

The preview has been updated.

As Progressive Image

More details can be found at Progressive Image

The preview has been updated.


Paragraph

This component is a wrapper for Typography, but outputting a <p> tag by default.

The preview has been updated.


Section

This component is a wrapper for Typography, but outputting a <section> tag by default.

The preview has been updated.


Span

This component is a wrapper for Typography, but outputting a <span> tag by default.

The preview has been updated.

Props

Img
See core props for additional props that can be applied to this component.
proptyperequireddefault
variant
Type of image to use.
"responsive""progressive""fluid"
false
fluid
onError
Callback function to handle error events.
ReactEventHandler<HTMLImageElement>((evt: Event) => void)null
false
null
aspectRatio
The height / width ratio expressed as the result of dividing the content's height by its width Examples: 16:9 => 9 / 16 => 0.5625, 1:1 => 1 / 1 => 1.0
number
true
null
intersectionOptions
Options for configuring the intersection observer behavior.
IntersectionOptions
false
{ threshold: 0 }
trigger
Specifies when to trigger the image loading. Can be one of 'immediate', 'inView', or a number (delay in milliseconds).
number"immediate""inView"null
false
inView
placeholder
stringnull
false
null

Related