Skip to content

<rc-section>

Full-width horizontal band that holds one or more columns. The primary layout row of an email — every visible content block lives inside a section.

Attributes

AttributeDefaultConstraintExampleDescription
background-colorCSS color value#f5f5f5Solid background colour for the section.
background-urlURLhttps://cdn.example.com/bg.jpgURL of a background image displayed behind the section content.
background-repeatrepeatrepeat | no-repeat | repeat-x | repeat-yno-repeatCSS background-repeat behaviour.
background-sizeautoCSS background-size valuecoverCSS background-size — keyword or dimension values.
background-positiontop centerTwo space-separated valuestop centerCSS background-position.
background-position-xCSS background-position-x valueleftHorizontal background position, overrides background-position.
background-position-yCSS background-position-y valuetopVertical background position, overrides background-position.
bordernoneCSS border shorthand1px solid #ccccccBorder applied to all four sides of the section.
border-bottomCSS border shorthand2px solid #000000Bottom border only.
border-leftCSS border shorthand1px dashed #ccccccLeft border only.
border-rightCSS border shorthand1px dashed #ccccccRight border only.
border-topCSS border shorthand2px solid #000000Top border only.
border-radiuspx or %, 1–4 values8pxRounded corners on the section.
css-classStringhero-sectionHTML class names applied to the rendered element.
directionltrltr | rtlrtlText and layout direction for the section.
full-widthfull-width | falsefull-widthMakes the section bleed edge-to-edge beyond the body width.
hidedesktop | mobilemobileHides the section on the specified device type.
padding20px 0px, 1–4 values40px 0Space between the section border and its columns.
padding-topPixel value40pxTop padding. Overrides the top value of padding.
padding-bottomPixel value40pxBottom padding.
padding-leftPixel value20pxLeft padding.
padding-rightPixel value20pxRight padding.
padding-on-mobilepx, 1–4 values20px 0Padding override applied only on mobile viewports.
text-aligncenterleft | center | rightleftDefault text alignment inherited by inline content.
text-padding4px 4px 4px 0px, 1–4 values4px 8px 4px 0Padding applied around inline text nodes within the section.

Children

ElementCardinalityDescription
<rc-column>1–20Vertical content cell.

Parents

JSON

json
{
  "tagName": "rc-section",
  "attributes": {
    "background-color": "#ffffff",
    "padding": "40px 0"
  },
  "children": [
    { "tagName": "rc-column", "children": [] }
  ]
}

XML

xml
<rc-section background-color="#ffffff" padding="40px 0">
  <rc-column>...</rc-column>
</rc-section>

Building

Templates can be built using factory functions from @rule/rcml, or the JSON structure above can be generated directly by an AI model — pass rcmlSpec as context when prompting.

typescript
import { createSectionElement, createColumnElement } from '@rule/rcml';

createSectionElement({
  attrs: { 'background-color': '#ffffff', padding: '40px 0' },
  children: [createColumnElement({ children: [] })],
})

API Reference