Skip to content
Content Blocks docsv0.8.0Website

Docs / Blocks

<content-tout-block>

A card that promotes something: an image or video with text below it, and an optional layer over the media that can show on hover.

Import it on its own, for a bundler
import '@content-blocks/js/components/content-tout-block';

Examples

Product card

An image with its name and price below. The whole card is one link, from content-button.

Open on its own
Steel helm 180 gold

Looping video

The card's media is a muted .mp4 on a loop, with a label laid over it in the mediaContent slot and its title below.

Open on its own
Omen The serpent stirs The sea rises, fjord by fjord.

Film in an overlay

The play button opens a video in a content-overlay, and fill="#ex-tout-film" makes it cover the card. hover="false|true" shows the button on phones and on hover from 768px.

Open on its own
▶ The raven’s message See what the ravens saw.

Anatomy

Content goes into the component's slots, chosen with the slot attribute on each child.

flowchart LR
  root["#lt;content-tout-block#gt;"]:::component
  root --> s0["<b>no slot (default)</b><br/>Default slot, same as content slot."]
  root --> s1["<b>slot=#quot;content#quot;</b><br/>This slot will usually serve a text block."]
  root --> s2["<b>slot=#quot;media#quot;</b><br/>This slot is usually a video or image component."]
  root --> s3["<b>slot=#quot;mediaContent#quot;</b><br/>This is a layer that floats the media layer and is revealed on hover."]
  classDef component fill:#141413,color:#faf9f5,stroke:#141413
The slots of <content-tout-block>
SlotWhat goes in it
(default)Default slot, same as content slot.
slot="content"This slot will usually serve a text block.
slot="media"This slot is usually a video or image component.
slot="mediaContent"This is a layer that floats the media layer and is revealed on hover.

Properties

Set them as attributes. Those marked responsive take a value per breakpoint, separated by pipes and named or in order: 1|tablet=2 or 1|2. Seeresponsive values.

AttributeTypeDefaultDescription
classesresponsiveString–Classes to add to the component. Use pipes for different classes per breakpoint, by name or in order: classes="stacked|laptop=side-by-side".
hoverresponsiveBoolean'false|true'If true, the media content will show only on hover
paddingresponsiveString–Padding around the component, written as CSS padding. Use pipes for different padding per breakpoint, by name or in order: padding="1rem|tablet=2rem 4rem" or padding="1rem|2rem 4rem|3rem 5rem 4rem".
flowchart LR
  v["hover=#quot;false|true#quot;"]:::value
  v --> b0["mobile, from 0px: false"]
  v --> b1["tablet and up, from 768px: true"]
  classDef value fill:#1d4ed8,color:#fff,stroke:#1d4ed8
How hover="false|true" from the examples applies at each breakpoint