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
🔍 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:
- Business Analyst defines: "We need a Hero Banner with a heading, sub-text, background image, and a CTA button"
- UX Designer creates the design mockup
- AEM Developer creates the component — dialog, HTL, Sling Model
- Front-end Developer writes the CSS/JS in Client Libraries
- 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.
🤔 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
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
🎯 Key Takeaways
🔗 Related Topics
🎯 Practice this topic in interviews
↗ Where this topic fits
AEM Technology Guide
Return to the AEM learning hub.
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.
Sources
Sources / References
Use these AEM references to verify the concept in official docs and continue into the most relevant SplashRide pages.
Official documentation
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.