HomeCore Learning Journey › Lab 4 — Build the plan-card component

Lab 4 — Build the plan-card component

Purpose: Create an authorable plan-card component with an HTL script and dialog, rendering the Lab 2 content.

Who this page is for

AudienceWhy it matters to you
All engineersPairs with Session 4; first real component build

Goal

An authorable plan-card with title, subtitle, premium and a covered/not-covered benefits list — the teaser version of the PHI gold-tier plan page.

Steps

  1. In your archetype project (ui.apps), create /apps/phi-academy/components/plancard/ with .content.xml

metadata: jcr:title = "Plan Card", componentGroup = "PHI Academy".

  1. Add plancard.html rendering title/subtitle/premium from properties for now

(${properties.title} etc.) — properties is HTL's direct window onto the component node.

  1. Create the dialog (_cq_dialog/.content.xml) with: textfield title, textfield subtitle,

numberfield monthlyPremium, and a multifield benefits with sub-fields label (text) and covered (checkbox).

  1. Deploy (mvn clean install -PautoInstallSinglePackage).
  2. In the page editor, add Plan Card to the page (enable the "PHI Academy" group in the template's policy if the

component is not offered — a Session 6 preview), configure it via the dialog, and verify rendering.

  1. In CRXDE, inspect the node the dialog wrote — multifield rows become child nodes. Compare with your hand-built

Lab 2 structure.

Checkpoint

VerifyHow
Empty-state safetyAdd a fresh Plan Card, leave dialog empty — page must not error
EscapingSet title to <b>Gold</b> — the tags must render as text, not bold (HTL escaped it)
Multifield structureBenefit rows are child nodes with label/covered properties

Stretch

Add a card.html selector script that renders a compact variant, and view the page with .card.html.

Quick navigation