---
title: Examples
slug: wip/m9Q6-examples
createdAt: 2023-07-20T14:45:03.180Z
---

# Examples

## Basic Usage

The Link Card only needs a few data points to render a fully functional card.

:::Iframe{iframeHeight="0" code="<iframe title=&#x22;Embeded content from codepen.io&#x22; class=&#x22;no-border max-full-width full-height flex-grow&#x22; src=&#x22;https://codepen.io/redbulldesign/embed/NWBpXqy/ad19ef379824aacb68ff933b69d5129a?default-tab=html%2Cresult&#x26;amp;theme-id=39623&#x26;amp;editable=true&#x22; height=&#x22;569px&#x22; loading=&#x22;lazy&#x22;></iframe>"}

:::

## Extended Usage

Optionally, the Link Card can be extended with additional information

:::Iframe{iframeHeight="0" code="<iframe title=&#x22;Embeded content from codepen.io&#x22; class=&#x22;no-border max-full-width full-height flex-grow&#x22; src=&#x22;https://codepen.io/redbulldesign/embed/KKBqgjr/459bb50633d48791e1490ee0acc1a75d?default-tab=html%2Cresult&#x26;amp;theme-id=39623&#x26;amp;editable=true&#x22; height=&#x22;550px&#x22; loading=&#x22;lazy&#x22;></iframe>"}

:::

## Preview Video

A great way to turn the Link Cards into an engaging teaser is to add a video that appears on the hover gesture.

:::Iframe{iframeHeight="0" code="<iframe title=&#x22;Embeded content from codepen.io&#x22; class=&#x22;no-border max-full-width full-height flex-grow&#x22; src=&#x22;https://codepen.io/redbulldesign/embed/mdjwRro/dc473a463960741fded3e15e0f230476?default-tab=html%2Cresult&#x26;amp;theme-id=39623&#x26;amp;editable=true&#x22; height=&#x22;712px&#x22; loading=&#x22;lazy&#x22;></iframe>"}

:::

## Responsive Image and Performance

A great way to balance client-side performance and responsive images is by using `srcset` in conjunction with `sizes` and `loading` attributes. Read more about responsive image best practices here: [Image](https://cosmos.redbull.design/wip/image)

:::Iframe{iframeHeight="0" code="<iframe title=&#x22;Embeded content from codepen.io&#x22; class=&#x22;no-border max-full-width full-height flex-grow&#x22; src=&#x22;https://codepen.io/redbulldesign/embed/KKrREqZ/d09bbac6ba41ddad2fe560b6ba94fce2?default-tab=html%2Cresult&#x26;amp;editable=true&#x26;amp;theme-id=39623&#x22; height=&#x22;538px&#x22; loading=&#x22;lazy&#x22;></iframe>"}

:::

## Logo

Instead of a tag, Link Cards can display a logo.

:::Iframe{iframeHeight="0" code="<iframe title=&#x22;Embeded content from codepen.io&#x22; class=&#x22;no-border max-full-width full-height flex-grow&#x22; src=&#x22;https://codepen.io/redbulldesign/embed/xxJrgPj/7f6f4cd038c09cd8bb1e8911f7ff5340?default-tab=html%2Cresult&#x26;amp;theme-id=39623&#x26;amp;editable=true&#x22; height=&#x22;550px&#x22; loading=&#x22;lazy&#x22;></iframe>"}

:::

**Best practices:**

- Logos should be SVG or PNG images with a transparent background
- Logos with a width/height ratio lower than 1.5 should have `logo-narrow` enabled to optimized the appearance on the card

## Preview Image

To improve the user experience Link Cards can *optionally* display preview images while waiting for the high-resolution image to be loaded.

*Note: The example below demonstrates the rendering of the preview image only. In a production environment, a high-resolution* `_image_` *would be set alongside.*

:::Iframe{iframeHeight="0" code="<iframe title=&#x22;Embeded content from codepen.io&#x22; class=&#x22;no-border max-full-width full-height flex-grow&#x22; src=&#x22;https://codepen.io/redbulldesign/embed/ef27dbbf0ff1720bf65b2317b36dedb0?default-tab=html%2Cresult&#x26;amp;theme-id=39623&#x26;amp;editable=true&#x22; height=&#x22;548px&#x22; loading=&#x22;lazy&#x22;></iframe>"}

:::

**Best Practices :**

- To ensure optimal performance and a seamless transition, use preview images that are scaled versions of the featured image, with a maximum width of 50px.
- To ensure meaningful content is shown as fast as possible without any additional network requests preview images should be provided as base64 encoded data URIs

## Mode and Appearance

By default, Link Cards adapt to a light mode environment and appear light themselves. In a dark mode environment, we recommend changing the Link Card appearance to dark.

:::hint{type="warning"}
**💡 Pro Tip**

The appearance of a Link Card can be set using the appearance property or by nesting it into a cosmos-mode component. Read more about the [Mode & Appearance](https://cosmos.redbull.design/wip/mode-and-appearance) concept.
:::

:::Iframe{iframeHeight="0" code="<iframe title=&#x22;Embeded content from codepen.io&#x22; class=&#x22;no-border max-full-width full-height flex-grow&#x22; src=&#x22;https://codepen.io/redbulldesign/embed/dyjROoN/fc5b17400404455120155260875e3508?default-tab=html%2Cresult&#x26;amp;theme-id=39623&#x26;amp;editable=true&#x22; height=&#x22;514px&#x22; loading=&#x22;lazy&#x22;></iframe>"}

:::

## Compact Layout

Link Cards support a compact layout for use cases where it doesn't have enough space available.

:::hint{type="warning"}
## 💡 Pro Tip

The Link Card's layout is a [Responsive Properties](https://cosmos.redbull.design/wip/responsive-properties) and can be configured per breakpoint. Try out [this example](https://codepen.io/redbulldesign/live/5f54a3975de145ea1c8f89a51439d100)
:::

:::Iframe{iframeHeight="0" code="<iframe title=&#x22;Embeded content from codepen.io&#x22; class=&#x22;no-border max-full-width full-height flex-grow&#x22; src=&#x22;https://codepen.io/redbulldesign/embed/OJwgbyv/713c7f082c7196e926351080d56c4cd0?default-tab=html%2Cresult&#x26;amp;theme-id=39623&#x26;amp;editable=true&#x22; height=&#x22;455px&#x22; loading=&#x22;lazy&#x22;></iframe>"}

:::

## Listen to Resize Events

When initially mounting and whenever the media container of the Story Card resizes, the card emits a `mediaresize` event including the media's width and height.

A common use case is to update the image to make it perfectly fit the available space.

:::Iframe{iframeHeight="0" code="<iframe title=&#x22;Embeded content from codepen.io&#x22; class=&#x22;no-border max-full-width full-height flex-grow&#x22; src=&#x22;https://codepen.io/redbulldesign/embed/xxJrRoL/f907a37199407544b107d1aff60c2b87?default-tab=html%2Cresult&#x26;amp;theme-id=39623&#x26;amp;editable=true&#x22; height=&#x22;693px&#x22; loading=&#x22;lazy&#x22;></iframe>"}

:::

