Handlebars provides a powerful, logic-less templating system for Handoff components. Learn how to use properties, design tokens, and custom Handoff helpers to build robust and reusable UI elements that are framework-agnostic.
Handlebars is the default templating engine for Handoff's static and server-rendered integration paths. It allows you to build components using standard HTML while injecting dynamic data from Figma via a simple, readable syntax.
A basic button component demonstrating property binding and conditional class names.
example.handlebarshandlebars1<button class="btn "> 2 3</button>
In this example, size, variant, and label are variables mapped from Figma via the component's config.json.
A more advanced example demonstrating loops, conditionals, and nesting.
example.handlebarshandlebars1<div class="card card-"> 2 3 <img src="" alt="" /> 4 5 6 <div class="card-body"> 7 <h3></h3> 8 <p></p> 9 10 11 <a href="" class="btn btn-primary">Learn More</a> 12 13 14 <ul class="feature-list"> 15 16 <li></li> 17 18 </ul> 19 </div> 20</div>
Handoff provides several custom helpers to make it easier to work with design system data and property validation.
eq (Equality)Used to compare two values, typically within an #if block.
example.handlebarshandlebars1 2 <!-- Render primary styles --> 3
#field (Property Binding)The #field helper wraps a part of your template to enable inspection and direct editing within the Handoff documentation site. It marks a piece of content as being tied to a specific Figma property.
example.handlebarshandlebars1 2 <span></span> 3
#if / #unless)Standard Handlebars logic for toggling parts of your template based on property values.
example.handlebarshandlebars1 2 <button>Click Me</button> 3
#each)Iterate over arrays of data, such as lists of features, menu items, or nested token sets.
example.handlebarshandlebars1<ul> 2 3 <li>: </li> 4 5</ul>