Skip to main content

Snippet

Content item component used inside a collection to render backend content fields as a text-first preview. Lives only inside .collection. Provides a featured type preset, sm and lg size values controlling internal spacing, and composable image-position values for left/right placement of an optional media item.

Usage​

When to use

  • Text-heavy listings: news, articles, search results, publications
  • Collections where the title, summary, and meta are the primary content and media is optional
  • Featured-item treatments for the first result in a listing

When not to use

  • Visual grids of primarily-image items - use a card item type instead
  • Standalone outside a collection - snippets always live inside .collection

Do

  • Render inside a .collection wrapper
  • Provide meaningful alt text on the media when present
  • Use the title link as the primary click target; the read-more link is supplementary

Don't

  • Use snippet as a search-result-only component - it is a generic content preview
  • Render snippets without the .collection wrapper
  • Crop or resize images outside the component tokens

API​

Slots​

SlotRequiredDescription
media-HTML content for the media slot (image or video).

Props​

PropTypeDefaultDescription
titlestring-Linked title text.
urlstring-Link URL for the title.
summarystring-Preview text.
supertitlestring-Small label rendered above the title.
datestring-Human-readable publication date.
date_isostring-ISO 8601 date for the machine-readable datetime attribute.
authorstring-Author name.
reading_timestring-Reading time estimate.
link_labelstringRead moreRead-more link text.
title_tagEnum: strong, h2, h3, h4, h5, h6h3Tag used for the title element.
tagsarray-Array of tag objects with url and text fields.
classesarray-Additional CSS class words merged into the root element.
attributesobject-Additional HTML attributes spread on the root element.

Classes​

ClassCapabilityDefaultDescription
.subtleEmphasis-Lower emphasis; a muted, quieter weight.
.neutralEmphasisYesDefault emphasis; the standard weight at balanced contrast.
.accentEmphasis-Higher emphasis; a stronger, louder weight.
.smSize-Small.
.lgSize-Large.
.horizontalOrientationYesChildren flow along the horizontal axis.
.verticalOrientation-Children flow along the vertical axis.
.featuredType-Editorial preset that enlarges media and title for prominent placement.
.reverseLayout-Reverses the media / text flex order.

Examples​

Default​

Standard layout with all fields visible and media on the left.

Small​

Dense layout for long listings - smaller image, fewer meta fields, tighter spacing.

Prominent layout for the hero result or first item in a list - larger image and title.

Image right​

Media positioned on the right of the text content.

Text only​

Snippet with no media - renders as a text-only item; the image-position class is ignored.

Composed .featured + .reverse value demonstrating that variants combine.

Accessibility​

  • WCAG 2.2 AA
  • Title is itself a link (not a separate "read more" target) so keyboard and screen-reader users reach it first
  • Appropriate heading level (default <h3>, assuming the collection sits under an <h2>)
  • Tags render as <ul> of real <a> elements
  • Media alt is meaningful when informative, empty when decorative
  • Date uses <time datetime="...">
  • Visible :focus-visible outline on all interactive elements
  • Sufficient color contrast for small meta text

Dependencies​

  • collection - required wrapper (snippets are never standalone)
  • card - parallel item type
  • hero - also uses supertitle