Array Helpers API reference for array manipulation template helpers list Guide

Array Helpers

Array helpers provide utilities for working with arrays in templates.

Functions

join

Joins array elements with a delimiter.

Template Syntax

{join itemsArray ', ' true}

Parameters

NameTypeDefaultDescription
arrayarray[]The array to join
delimiterstring’ ‘The delimiter to use
spaceAfterbooleanfalseWhether to add a space after the joined string

Returns

string - The joined string.

Example

<p>Categories: {join categories ', ' false}</p>

joinComma

Joins array elements with commas.

Template Syntax

{joinComma itemsArray true false}

Parameters

NameTypeDefaultDescription
arrayarray[]The array to join
oxfordbooleanfalseWhether to use Oxford comma
quotesbooleanfalseWhether to wrap items in quotes

Returns

string - The comma-joined string.

Example

<p>This product comes in {joinComma colors true true}.</p>

range

Returns an array with a range of numbers.

Template Syntax

{#each number in range 1 6}
{number}
{/each}

Parameters

NameTypeDefaultDescription
startnumberThe start of the range
stopnumberThe end of the range
stepnumber1The step between numbers

Returns

array - An array containing the range of numbers.

Example

<select name="birthyear">
{#each range 1900 2024}
<option value="{this}">{this}</option>
{/each}
</select>