2026 Community Survey results are here! See how the Craft CMS community works. results are live!

Craft CMS 5 Guide

Course Videos

Passing Variables to Partials

How to pass data into a partial template.

As part of the beta 7 release, Craft CMS now includes the abil­i­ty to pass vari­ables into therender() method so you use the data inside of your par­tials templates.

This new addi­tion was a pull request from Andrew Welch after a dis­cus­sion on the Craft CMS Dis­cord server.

Now you can do some­thing like:

block.render( { themeColor: "gray-900" } )
Craft Version
Craft 5
Instructor
Level
Beginner
Date Published
March 13, 2024