Loading...
A NSW Government website
Search for a command to run...
The section component is a container used to group related content in email layouts. It provides consistent spacing, alignment, and background colour, helping to visually separate parts of a message such as introductions, feature blocks, calls to action, or footers.
A section is implemented in the framework as a full-width wrapper table. It applies background colour and vertical padding, while ensuring reliable rendering across all major email clients.
Use a section to:
<yield> slot, meaning you can nest rows, columns, or other components inside.role="presentation" to ensure it is ignored by assistive technologies.In the codebase, the section is defined in section.html as a partial:
<script props>
  module.exports = {
    align: props.align || 'center',
    bgcolor: props.bgcolor || '#FFFFFF',
    valign: props.valign || 'top',
    padding: props.padding !== undefined ? parseInt(props.padding, 10) : props.page.padding,
  }
</script>
<table class="wrapper" align={{{align}}} bgcolor={{{bgcolor}}} cellpadding="0" cellspacing="0" width="100%" role="presentation">
  <tr>
    <td style="padding: {{{padding}}}px 0px;">
      <yield />
    </td>
  </tr>
</table>| Prop | Default | Description | 
|---|---|---|
| align | center | Horizontal alignment of the section table. | 
| bgcolor | #FFFFFF | Background colour of the section. | 
| valign | top | Reserved for vertical alignment flexibility. | 
| padding | page.padding (16) | Vertical spacing above and below content, in pixels. | 
<x-section bgcolor="#F5F5F5" padding="48">
  <x-row>
    <x-column>
      <h2>Important update</h2>
      <p>We’ve made improvements to your dashboard.</p>
    </x-column>
  </x-row>
</x-section>This outputs:
Do
<x-section> to separate major blocks of content.Don't