Skip to main content

Overview

The Card block (_card.liquid) is a versatile container that supports background media (images or videos), overlay effects, and flexible content layouts. Cards can contain nested blocks and support various aspect ratios and alignment options.

Schema Definition

Supported Child Blocks

The card block accepts these nested block types:

Configuration Settings

Layout Settings

select
default:"column"
Direction of content flow
  • column - Vertical layout
  • row - Horizontal layout
checkbox
default:"true"
Force vertical layout on mobile devices (when content_direction is “row”)
select
default:"flex-start"
Horizontal alignment for row layouts
  • flex-start - Left aligned
  • center - Center aligned
  • flex-end - Right aligned
  • space-between - Distribute space between items
select
default:"center"
Vertical position for row layouts
  • flex-start - Top
  • center - Center
  • flex-end - Bottom
select
default:"center"
Vertical position for column layouts
  • flex-start - Top
  • center - Center
  • flex-end - Bottom
  • space-between - Distribute space
range
default:"12"
Spacing between child elements (0-100px)

Appearance Settings

checkbox
default:"true"
Inherit color scheme from parent section
color_scheme
default:"scheme-1"
Color scheme when not inheriting (visible_if: inherit_color_scheme == false)
select
default:"none"
Background media type
  • none - No background
  • image - Static image
  • video - Video background
image_picker
Background image (visible when background_media is “image”)
video
Background video (visible when background_media is “video”)
select
default:"adapt"
Card aspect ratio (visible when background_media is set)
  • adapt - Auto (based on media)
  • portrait - 2:3 ratio
  • square - 1:1 ratio
  • landscape - 16:9 ratio

Overlay Settings

checkbox
default:"false"
Enable media overlay
color
default:"#00000026"
Overlay color with alpha support (visible when toggle_overlay is true)
select
default:"solid"
Overlay style
  • solid - Solid color
  • gradient - Gradient effect
select
default:"to top"
Gradient direction (visible when overlay_style is “gradient”)
  • to top - Bottom to top fade
  • to bottom - Top to bottom fade
Make entire card clickable
checkbox
default:"false"
Open link in new tab

Padding Settings

range
default:"0"
Top padding (0-100px)
range
default:"0"
Bottom padding (0-100px)
range
default:"0"
Left padding (0-100px)
range
default:"0"
Right padding (0-100px)

Liquid Implementation

Basic Structure

Aspect Ratio Logic

CSS Classes

Main Classes

  • .card - Main container with overflow hidden and border radius
  • .card__content - Content wrapper with z-index layering
  • .card__inner - Flex container for child blocks
  • .card__media-wrapper - Absolute positioned background media
  • .card__link - Full-card clickable overlay

Utility Classes

  • .color-{scheme} - Color scheme variants
  • .layout-panel-flex - Flexbox layout system
  • .background-transparent - Transparent background for overlay effects

Usage Examples

Card with Background Image

Horizontal Card Layout

Clickable Card

Source Code Reference

View the complete implementation: /source/blocks/_card.liquid:1-533