Skip to main content

Introduction

Horizon showcases the latest Liquid Storefronts features, representing the future of Shopify theme development. These modern Liquid capabilities enable more flexible, maintainable, and powerful themes.
Liquid Storefronts is the evolution of Shopify’s templating system, introducing features like theme blocks, content_for, section groups, and more.

Theme Blocks

Theme blocks are the cornerstone of Liquid Storefronts, enabling reusable, composable components.

What are Theme Blocks?

Theme blocks are Liquid files in the blocks/ directory that:
  • Can be added to any section that accepts { "type": "@theme" }
  • Are prefixed with an underscore (_heading.liquid, _content.liquid)
  • Include their own schema and settings
  • Are fully reusable across sections

Basic Theme Block Structure

blocks/_heading.liquid

Accepting Theme Blocks in Sections

sections/_blocks.liquid
The @theme wildcard allows merchants to add any theme block from your blocks/ directory to the section. This provides maximum flexibility without hardcoding which blocks are allowed.Benefits:
  • Merchants can compose custom layouts
  • No need to update section schema when adding new blocks
  • Enables true composability

Nestable Theme Blocks

Horizon’s _content block demonstrates nested blocks:
blocks/_content.liquid
1

Content block added to section

Merchant adds _content block to a section
2

Nested blocks added

Merchant adds _heading, _image, and button blocks inside the _content block
3

Rendered with proper nesting

The content_for 'blocks' captures nested children, and group snippet renders them with proper layout

content_for Tag

The {% content_for %} tag is a powerful Liquid Storefronts feature for rendering dynamic content.

Basic Usage

Advanced: content_for with Static Blocks

sections/carousel.liquid
Static blocks are defined in the section schema with "static": true and always render in the same position.

content_for with Context

Pass additional context to blocks:
Blocks can access context via closest object:
blocks/_product-card.liquid

Section Groups

Section groups allow multiple sections to be rendered as a cohesive unit.

Header Group

layout/theme.liquid
sections/header-group.json

Benefits

  • Logical grouping of related sections
  • Independent customization
  • Better performance (grouped rendering)
  • Cleaner template files

Use Cases

  • Header (announcements + navigation)
  • Footer (links + newsletter + social)
  • Product page (details + recommendations)

Static vs Dynamic Blocks

Static Blocks

Static blocks always appear and cannot be removed by merchants:

Dynamic Blocks

Dynamic blocks can be added, removed, and reordered:

Documentation Tags

Horizon uses {%- doc -%} tags for inline documentation:
  • Self-documenting code
  • Better developer experience
  • Clear parameter expectations
  • Usage examples embedded in code

Visible_if Conditions

Conditionally show/hide settings in the theme editor:
visible_if creates dynamic, contextual settings that only appear when relevant, improving the merchant experience.

Advanced Liquid Patterns

Liquid Tag

The {% liquid %} tag allows multi-line Liquid without repetitive delimiters:
Vs. traditional syntax:

Inline Stylesheets

Scope CSS to specific components:
snippets/bento-grid.liquid
  • Scoped styles: CSS only loads when the snippet is used
  • Co-location: Styles live with markup
  • Performance: Automatic critical CSS extraction
  • Maintainability: Easier to update components

Translation Integration

Horizon uses t: prefixes for all translatable strings:
Translation files in locales/:
locales/en.default.json

Color Schemes

Horizon uses the color scheme system:
Applied via CSS classes:
Color scheme CSS variables:

Request Object Enhancements

Visual Preview Mode

Design Mode Detection

Performance Features

SVH Units

Horizon uses svh (small viewport height) for better mobile support:

Lazy Loading

Preloading Critical Assets

Best Practices

Create small, focused theme blocks that do one thing well. Compose complex layouts by combining multiple blocks.
Use content_for 'blocks' to capture dynamic content and content_for 'block' for static blocks.
Always document snippets and complex blocks with parameter descriptions and examples.
Hide irrelevant settings to create a better merchant experience.
Use {% liquid %} for complex logic to improve readability.
Keep CSS co-located with components using inline stylesheet tags.

Examples from Horizon

Complete Section Example

sections/_blocks.liquid

Migration from Legacy Patterns

Next Steps

Theme Blocks Deep Dive

Learn advanced theme blocks patterns

Theme Structure

Understand sections, blocks, and snippets

Development Guide

Start building with Liquid Storefronts

API Reference

Official Shopify documentation