Overview
Media blocks handle visual content including images and videos. Horizon provides three media block types:- Image Block - Static images with aspect ratio controls
- Video Block - Uploaded or external videos with playback options
- Media Block - Unified block supporting both images and videos
Image Block
Displays responsive images with aspect ratio control and optional linking.Settings
image_picker
Image to display
url
Optional URL to link the image
Size Settings
select
default:"adapt"
Image aspect ratio
adapt- Use original image ratioportrait- 4:5 ratio (taller)square- 1:1 ratiolandscape- 16:9 ratio (wider)
select
default:"fill"
Desktop width behavior
fit-content- Fit to image sizefill- Fill available spacecustom- Custom percentage
range
default:"100"
Custom width percentage (0-100%, visible when width is “custom”)
select
default:"fill"
Mobile width behavior
fit-content- Fit to imagefill- Fill containercustom- Custom percentage
range
default:"100"
Mobile custom width (0-100%)
select
default:"fit"
Height behavior (visible when image_ratio is “adapt”)
fit- Fit to contentfill- Fill container height
Border Settings
select
default:"none"
Border style (
none or solid)range
default:"1"
Border thickness (0-100px)
range
default:"100"
Border opacity (0-100%)
range
default:"0"
Corner radius (0-100px)
Padding Settings
Standard padding controls (0-100px) for all four sides.Liquid Implementation
CSS Classes
.image-block- Main container with flex display.image-block__image- Image element with object-fit cover.image-block--height-fill- Fills parent height.placeholder-image- Placeholder when no image selected.border-style- Border styling utilities
Video Block
Supports both uploaded videos and external video URLs (YouTube, Vimeo).Settings
select
default:"uploaded"
Video source type
uploaded- Shopify-hosted video fileurl- External video URL
video
Uploaded video file (visible when source is “uploaded”)
video_url
External video URL from YouTube or Vimeo (visible when source is “url”)
checkbox
default:"false"
Autoplay video on page load
checkbox
default:"true"
Loop video playback
image_picker
Custom cover/poster image (visible for external videos when autoplay is off)
text
Alternative text for accessibility (visible for external videos)
Size Settings
range
default:"100"
Desktop width (0-100%)
range
default:"100"
Mobile width (0-100%)
select
default:"auto"
Video aspect ratio (for external videos without cover image)
auto- Automatic9/16- Portrait (9:16)1/1- Square16/9- Landscape (16:9)
Liquid Implementation
Media Block
Unified block that can display either an image or video based on settings.Settings
select
default:"image"
Type of media to display
image- Static imagevideo- Video content
image_picker
Image to display (visible when media_type is “image”)
url
Link URL (visible when media_type is “image”)
video
Video file (visible when media_type is “video”)
checkbox
default:"true"
Loop video playback (visible when media_type is “video”)
checkbox
default:"false"
Autoplay video (visible when media_type is “video”)
Appearance Settings
checkbox
default:"true"
Inherit color scheme from parent section
color_scheme
default:"scheme-1"
Color scheme when not inheriting
range
default:"0"
Corner radius (0-100px)
Padding Settings
Standard padding controls for all four sides (0-100px).Liquid Implementation
media snippet which handles the conditional rendering of images or videos.
Responsive Images
All image blocks use Shopify’s responsive image system:- Multiple image sizes in
srcset - Automatic size selection based on viewport
- Lazy loading support
- Optimal performance
Usage Examples
Hero Image
Looping Background Video
YouTube Embed
Gallery Layout
Best Practices
Image Optimization
- Upload high-resolution images (at least 2000px wide)
- Use appropriate formats (WebP for photos, SVG for logos)
- Set alt text for accessibility
- Choose correct aspect ratio to avoid cropping
Video Performance
- Use autoplay sparingly - Can impact page performance
- Provide cover images - Faster initial load
- Consider file size - Compress videos before upload
- Use external URLs - YouTube/Vimeo for longer content
Responsive Design
- Set mobile widths - Different sizing for small screens
- Test aspect ratios - Ensure content looks good at all sizes
- Use adaptive ratios - When image proportions are important
- Add padding - Provide breathing room on mobile
Source Code Reference
- Image Block:
/source/blocks/image.liquid:1-331 - Video Block:
/source/blocks/video.liquid:1-255 - Media Block:
/source/blocks/_media.liquid:1-135