AEM Components Explained: Dialogs, HTL, Sling Models, and Core Components

Learn AEM components with component nodes, dialogs, HTL, Sling Models, Core Components, authoring, inheritance, and real project patterns.

Last reviewed: August 2026

·AEM 6.3+AEM 6.4AEM 6.5AEM as a Cloud Service
✅
Quick Understanding: An AEM component is a reusable authorable building block made from a component node, dialog, HTL rendering, optional Sling Model, and client libraries. Authors place components on pages; developers define their structure, behavior, and safe reuse.

🔍 What Is It?

An AEM component is a combination of:

  • →A JCR node under /apps/your-project/components/ that defines the component
  • →A dialog (XML) that gives authors a form to fill in content
  • →An HTL/Sightly template that renders the HTML
  • →An optional Sling Model (Java) that provides business logic
  • →Optional CSS/JS via Client Libraries

Every piece of content you see on an AEM page — a banner, a card, a text block, a navigation — is a component.

🎯 Why Do We Need It?

Without components, every page would need a developer to hard-code HTML. Components solve this by:

  • →Letting authors add and configure content without touching code
  • →Ensuring consistent design across thousands of pages
  • →Making content reusable and maintainable
  • →Allowing developers to build once, authors to use many times

In enterprise projects, a typical website has 30–80 custom components. The component model is what makes AEM different from a static website builder.

🏗️ What Happens in Real Projects?

In a real project, here's how components come to life:

  1. Business Analyst defines: "We need a Hero Banner with a heading, sub-text, background image, and a CTA button"
  2. UX Designer creates the design mockup
  3. AEM Developer creates the component — dialog, HTL, Sling Model
  4. Front-end Developer writes the CSS/JS in Client Libraries
  5. Content Author drags the component onto a page, fills in the dialog, and publishes

In practice, most AEM projects use a mix of custom components (built by your team) and Core Components (Adobe's open-source component library). You'll often extend Core Components rather than building from scratch.

⚙️ How It Works

Here's the anatomy of a component:

1. Component Node (`/apps/mysite/components/hero`)

This is the JCR node that registers the component. Key properties:

  • →jcr:primaryType = cq:Component
  • →jcr:title = Hero Banner (shown in component picker)
  • →componentGroup = My Site - Content
  • →sling:resourceSuperType = used for inheritance

2. Dialog (`cq:dialog`)

XML structure that defines the author-facing form. Uses Granite UI widgets (textfield, pathbrowser, checkbox, etc.).

3. HTL Template (`hero.html`)

The rendering script. AEM finds this file by matching the sling:resourceType of the content node to the component path.

4. Sling Model (`HeroModel.java`)

Java class annotated with @Model that adapts the resource and provides data to HTL via @Inject or @ValueMapValue.

5. Content Node (stored in `/content`)

When an author drops a component and fills the dialog, AEM saves the values as a JCR node under the page's jcr:content.

💻 Example

Building a Simple Hero Banner Component — A minimal but complete example of a Hero Banner component from node definition to rendering.

xml
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
          xmlns:cq="http://www.day.com/jcr/cq/1.0"
          xmlns:jcr="http://www.jcp.org/jcr/1.0"
    jcr:primaryType="cq:Component"
    jcr:title="Hero Banner"
    componentGroup="MyProject - Content"
    sling:resourceSuperType="core/wcm/components/image/v3/image"/>

🤔 Common Confusions

❓ What is the difference between a component and a template?

A template defines the overall page structure and which components are allowed. A component is the actual content block placed inside the page. Templates are the canvas; components are what you paint on it.

❓ Do I always need a Sling Model?

No. For very simple components (just a text field or a link), you can read properties directly with ${properties.heading} in HTL. Sling Models shine when you need logic, computed values, or external service calls.

❓ What is sling:resourceSuperType?

It's component inheritance. If your Hero inherits from Core Components Image, it gets all of Image's behavior and you only override what you need. Think of it like Java class extension for components.

❓ Where does component content get stored?

Under /content/your-site/page/jcr:content/root/container/hero. The content node's sling:resourceType points back to your component in /apps, which is how AEM knows which script to use for rendering.

🚨 Common Production Issues

Dialog not showing up after deployment

usually a missing or malformed .content.xml in the _cq_dialog folder.

Component renders blank on publish

the Sling Model class is not included in the bundle, or the OSGi bundle failed to activate.

Authors cannot see the component in the Component Picker

componentGroup is wrong or the template's allowed components policy doesn't include your component.

Edits in dialog don't save

the name attribute in dialog XML doesn't match what the Sling Model reads, or the property path is missing the "./" prefix.

Component works in Author but breaks in Publish

often a missing ClientLib category or a Sling Model that calls an OSGi service not available on publish.

Component output is cached incorrectly

the component renders user-specific or time-sensitive data inside a cacheable page. Move dynamic data client-side or mark the containing response as non-cacheable.

Component breaks after Core Component upgrade

custom overlay copied too much from /libs instead of using resourceSuperType delegation.

Headless JSON output is missing fields

Sling Model Exporter getters or Content Fragment references were not designed as a stable API contract.

✅ Best Practices

Always use Core Components as a base when possible

they handle accessibility, responsive images, and author experience out of the box.

Use DefaultInjectionStrategy.OPTIONAL in Sling Models to prevent null pointer exceptions when a field is not filled.

Keep dialog fields minimal

only expose what the author actually needs. Too many options confuse authors and create inconsistent pages.

Name your component clearly and use a meaningful componentGroup so authors can find it easily.

Never put business logic in HTL

use Sling Models for any computation, formatting, or conditional logic.

Write unit tests for Sling Models using AemContext from wcm.io testing.

Design dialogs with author validation, sensible defaults, and help text for fields that affect compliance, personalization, or analytics.

Review component cache behavior before go-live; most component bugs at scale are really caching or invalidation bugs.

Prefer delegation to Core Components over overlays so Adobe updates remain easier to adopt in AEM as a Cloud Service.

🏛️ Architect's Note

Senior Architect's Perspective

In large enterprise projects, components follow a strict hierarchy:

Base Layer → Core Components (Adobe)

Brand Layer → Your project's base components (extend Core)

Site Layer → Site-specific overrides

This means you rarely build from scratch. You extend, override, and configure. A good architect will also define a Component Library so developers and authors can see all components in isolation before they hit a real page.

For AEM as a Cloud Service, ensure your components are compatible with the Headless delivery model using Sling Models Exporter — even if you're not headless today, it's future-proofing.

💬 Frequently Asked Questions

How many components should a typical AEM project have?

A typical enterprise project has 30–60 custom components. The goal is to keep it minimal — more components mean more maintenance. Use Core Components for generic content and only build custom components for truly unique business requirements.

What is the difference between a parsys and a container?

parsys (Paragraph System) is the old AEM 6.x way of creating droppable areas. Container is the modern equivalent used with Editable Templates. In new projects, always use the Layout Container from Core Components instead of parsys.

Can a component include another component?

Yes, using data-sly-resource in HTL. This is called component composition. For example, a Card component might include a separate Image component inside it. Be careful with deep nesting — it makes debugging harder.

What is an overlay vs an override?

An overlay copies a file from /libs to /apps at the same path, giving you full control. An override uses sling:resourceSuperType to inherit and selectively change behavior. Overlays are fragile (break on upgrades); overrides are preferred.

How do I make a component available only on specific templates?

Use Template Editor's policy configuration. In the Editable Template editor, go to the structure mode and configure the Layout Container's allowed components policy to include only the components you want.

🎯 Key Takeaways

1A component = Node + Dialog + HTL + Sling Model + ClientLibs
2Content lives in /content; component code lives in /apps
3sling:resourceType is the bridge between content and rendering
4Always extend Core Components instead of building from zero
5Keep dialogs simple — authors are not developers
6Sling Models handle logic; HTL handles presentation

🎯 Practice this topic in interviews

↗ Where this topic fits

Sources

Sources / References

Use these AEM references to verify the concept in official docs and continue into the most relevant SplashRide pages.

Related SplashRide pages

SplashRide AEM learning path

Browse the full AEM topic collection and learning order on SplashRide.

AEM Interview Prep

Practice AEM interview questions and scenario-based answers.

AEM Developer Career Path

This AEM developer career path explains how to become an AEM developer through JCR, Sling, HTL, client libraries, Dispatcher, Cloud Service delivery, project depth, and interview-ready enterprise implementation skills.

Drupal Developer Career Path

A practical route through Drupal content modeling, site building, theming, modules, configuration management, APIs, performance, deployment discipline, and interview preparation.

AEM Templates

Understand AEM templates — the foundation of every page. Learn the difference between static and editable templates and how they shape the author experience.

Editable Templates

Learn how Editable Templates replaced static templates in AEM and how they give template authors control over page structure without developer involvement.