Skip to main content
Fluid themes provide three ways to reuse markup:
  • Components are Liquid partials that accept values when you render them.
  • Inline blocks are configurable items defined and rendered by one section.
  • Standalone theme blocks package markup and schema for reuse across sections.
Choose the smallest primitive that gives editors the control they need.

Use a component

Create a component when you want to reuse markup without adding an editor-controlled item. Components do not have their own schema. Store each component in its own directory:
Render a component with named values:
Inside the component, use the passed values like regular Liquid variables:
Document the accepted values in a Liquid comment at the top of the component. Give optional values a fallback. A component can render another component.

Use an inline block

Use an inline block when an item belongs to one section. Define its schema inside the section and render it from section.blocks.
Add {{ block.fluid_attributes }} to the block’s outer element. The editor uses these attributes to identify the selected item.

Use a standalone theme block

Use a standalone theme block when several sections need the same configurable item. A standalone block owns both its Liquid markup and its schema. Store blocks under blocks/:
For example, blocks/heading/index.liquid can contain:
Render the section’s standalone blocks with content_for:
content_for 'blocks' renders each block through its own template. Do not also loop over section.blocks to render the same standalone blocks.

Control which blocks a section accepts

Add {"type": "@theme"} to accept every public standalone block in the theme. Reference a block by name when the section should accept only selected block types:
A named reference contains type without an inline name or settings definition. Fluid reads the matching standalone block’s schema. You can combine public blocks, named references, and inline blocks:

Keep a standalone block private

Prefix a standalone block name with _ to exclude it from @theme. Reference the private block by its exact name in sections that need it:
Use private blocks for section-specific structure that should not appear in every compatible block picker.

Nest standalone blocks

A standalone block can accept child blocks. Inside its template, content_for 'blocks' renders the current block’s children.
Fluid supports two levels of block nesting. Keep the hierarchy shallow so editors can understand and reorder it.

Render a fixed block

Use the singular content_for 'block' form for a block that belongs in a fixed position:
You can pass a nearby resource through the closest namespace:
The block can then read closest.product. This pattern is useful when the surrounding section controls the resource but the block controls its presentation.

Add presets

Presets provide initial settings and blocks when an editor adds a section or standalone block. They can also expose multiple configured variants in the picker.
Add at least one preset when authors should be able to add the item from the editor. Use realistic defaults that produce a useful preview.

Compare the options

Use a component for rendering concerns. Use a block for editor-owned content. A standalone block can render a component when you need both behaviors. See schema components for setting types and schema rules. See the developer guide for the complete theme structure.