React
Properties
Section titled “Properties”Heading component renders a title with a description and up to two call-to-action buttons. It supports two visual themes (small and large), a dark color scheme, and EV-specific styling.
| Prop | Type | Description | Optional |
|---|---|---|---|
title |
string |
The heading text, rendered as an <h2>. |
❌ |
description |
string |
Supporting text rendered below the title. | ❌ |
theme |
'small' | 'large' |
Visual variant. Controls which elements (dividers, pre-title, logo) are available. Applied as dxp-heading--{theme}. |
❌ |
id |
string |
Id attribute applied to the root element. | ✅ |
preTitle |
string |
Short text displayed above the title. Only rendered when theme is large. |
✅ |
links |
LinkModel[] |
List of link models. The first item is the primary button and the second is the secondary button. Additional items are ignored. | ✅ |
colorScheme |
'light' | 'dark' |
Set to dark to render the contrast color scheme (tng-scheme is-contrast). Any other value renders the default scheme. |
✅ |
hasUpperDivider |
boolean |
Renders a divider above the heading. Only applies when theme is small. |
✅ |
hasBottomDivider |
boolean |
Renders a divider below the title. Only applies when theme is small. |
✅ |
hasLogo |
boolean |
Renders the brand logo above the title. Only applies when theme is large. |
✅ |
isEV |
boolean |
Forces the EV divider variant. The EV variant is also applied automatically on EV page templates. | ✅ |
Context Dependencies
Section titled “Context Dependencies”The component reads the following values from the custom context:
| Context key | Used for |
|---|---|
brand |
Determines which logo is rendered by BrandLogo when hasLogo is true. |
pageTemplate |
Checked against EV_TEMPLATES to decide whether the EV divider variant should be used. |
Themes
Section titled “Themes”- Supports
hasUpperDivider(above the heading) andhasBottomDivider(below the title). - Does not render
preTitleor the brand logo, even if the props are provided.
- Supports
preTitleandhasLogo. - Does not render dividers, even if the props are provided.
Buttons
Section titled “Buttons”- A button is only rendered when its link exists and its
linkTypeis notLINK_TYPE.NONE. - The accessible label of each button is the link’s
internalTitle, falling back tolinkText.
Examples
Section titled “Examples”import { Heading } from '@tmedxp/aem-react-components';
const SmallHeadingExample = () => { return ( <Heading id="heading-small" theme="small" title="Our services" description="Everything you need, in one place." hasUpperDivider={true} hasBottomDivider={true} links={[ { linkText: 'Learn more', linkType: 'internal', href: '/learn-more' }, ]} /> );};
const LargeHeadingExample = () => { return ( <Heading id="heading-large" theme="large" colorScheme="dark" preTitle="New" title="Discover the range" description="Find the model that fits your needs." hasLogo={true} links={[ { linkText: 'Explore', linkType: 'internal', href: '/explore' }, { linkText: 'Contact us', linkType: 'internal', href: '/contact' }, ]} /> );};
export { LargeHeadingExample, SmallHeadingExample };Output Examples
Section titled “Output Examples”Input (theme="small"):
Section titled “Input (theme="small"):”<Heading theme="small" title="Our services" description="Everything you need." hasUpperDivider={true} hasBottomDivider={true}/>Output:
Section titled “Output:”<div class="dxp-heading dxp-heading--small tng-container"> <!-- Divider variant: is-primary (or is-ev) --> <Divider class="dxp-heading-divider" /> <div class="dxp-heading-container"> <div class="dxp-heading-container-title"> <h2 class="dxp-heading-title tng-content">Our services</h2> <Divider class="dxp-heading-title-divider" /> </div> <div class="dxp-heading-container-content"> <p class="dxp-heading-description tng-content">Everything you need.</p> </div> </div></div>Input (theme="large", dark, two links):
Section titled “Input (theme="large", dark, two links):”<Heading theme="large" colorScheme="dark" preTitle="New" hasLogo={true} title="Discover the range" description="Find the model that fits your needs." links={[primaryLink, secondaryLink]}/>Output:
Section titled “Output:”<div class="dxp-heading dxp-heading--large tng-container tng-scheme is-contrast"> <div class="dxp-heading-container"> <div class="dxp-heading-container-title"> <span class="dxp-heading-pretitle">New</span> <BrandLogo class="dxp-heading-logo" /> <h2 class="dxp-heading-title tng-content">Discover the range</h2> </div> <div class="dxp-heading-container-content"> <p class="dxp-heading-description tng-content"> Find the model that fits your needs. </p> <div class="dxp-heading-buttons"> <!-- Primary button --> <MainButtonAem class="dxp-heading-btn" size="lg" /> <!-- Secondary button --> <MainButtonAem class="dxp-heading-btn" size="lg" /> </div> </div> </div></div>