CanvasFunctionsCanopy

cms_heading

The cms_heading function is used to define a heading component which can be edited on the Canopy editor.

{{ cms_heading(name, { element: '...', value: '...', class: '...' }) }}
ArgumentDescriptionData Type
nameThe element identifierString
element (optional)The HTML element type of the heading (h1, h2, h3, h4, h5, or h6)String
value (optional)The text content to be displayed within the headingString
class (optional)A space-separated list of CSS classes to style the heading componentString

The class variable is only accessible in the code. All other variables are available in the Canopy editor.

Heading component template

<{{ element }} class="{{class}}">
  {{ value }}
</{{ element }}>

Rendered HTML output

<h2 class="bg-white">String passed in value</h2>

Example

index.html
{{ cms_heading('myheading', { element: 'h3', value: 'Welcome to our page', class: 'text-blue-500 font-bold' }) }}

Last updated on