Slots for Custom Toolbar and Header Content
Customize toolbar buttons and header elements in the TPM Trade Planning Lightning web component (LWC) by placing your own content in its named slots.
Required Editions
| Available in: Lightning Experience |
| Available in: Enterprise, Unlimited, Einstein 1, and Agentforce 1 Editions with Consumer Goods Cloud Trade Promotion Management |
The TPM Trade Planning LWC exposes named slots for the toolbar and the page header. To fill a
slot, add an element inside the cgcloud-tpm-trade-planning tag and set its
slot attribute to the slot name. Content that you place in a slot replaces
the default content for that region of the page.
The icon, title, and all four toolbar slots appear on both Trade Calendar and Account Plan. To
display different content on each page, check getActiveBusinessObject() or
listen for the tpm_businessobjectchange event. The breadcrumbs and subtitle
slots show only on Account Plan.
Toolbar Slots
There are four slots. Two slots replace existing buttons, and two slots are empty by default.
left-buttons- The left toolbar region. The default content is the View dropdown menu. Content in the
left-buttonsslot replaces the View dropdown menu. To preserve view selection, build a custom picker by listening for theviewlistchangeevent, and call theselectView(viewId)method. center-buttons- A reserved center region with no default content. Use the
center-buttonsslot to add a button without replacing any existing toolbar buttons. right-buttons- The entire right toolbar region. The default content includes Print or Download,
Refresh, Filter, view controls, P&L, Copy Promotions, and New Promotion. Content in
the
right-buttonsslot replaces all of these buttons on both Trade Calendar and Account Plan. To preserve these actions, bind custom buttons torefresh(),toggleFilter(),runViewAction(),print(),download(),newPromotion(),copyPromotion(), andgoToAccountPlan(). fullheight-buttons- A region that spans the full height of the header row, with no default content.
This markup shows where each toolbar slot appears in the
cgcloud-tpm-trade-planning tag.
<cgcloud-tpm-trade-planning>
<span slot="left-buttons">…</span> <!-- replaces the View dropdown menu -->
<span slot="center-buttons">…</span> <!-- appears between the left and right regions -->
<span slot="right-buttons">…</span> <!-- replaces the entire right toolbar -->
<span slot="fullheight-buttons">…</span> <!-- spans the full height of the header row -->
</cgcloud-tpm-trade-planning>Header Slots
There are four header slots. Content that you add to a header slot isn't associated with an
EAR code, so setEARight() doesn't hide or disable it. Control the
visibility and enabled state of slotted content in your own component.
icon- The header icon.
title- The Trade Calendar or Account Plan title.
breadcrumbs- The page breadcrumbs. Available in the Account Plan view only.
subtitle- The page subtitle. Available in the Account Plan view only.
This markup shows where each header slot appears in the
cgcloud-tpm-trade-planning tag.
<cgcloud-tpm-trade-planning>
<span slot="icon">…</span> <!-- replaces the icon -->
<span slot="title">…</span> <!-- replaces the title -->
<span slot="breadcrumbs">…</span> <!-- replaces the breadcrumbs (Account Plan only) -->
<span slot="subtitle">…</span> <!-- replaces the subtitle (Account Plan only) -->
</cgcloud-tpm-trade-planning>This markup adds a Promotions button to the center-buttons slot, so the
existing toolbar buttons stay in place. When a user clicks Promotions, the button calls the
togglePromotionList handler in your component.
<cgcloud-tpm-trade-planning data-id="tradePlanning">
<lightning-button
slot="center-buttons"
label="Promotions"
icon-name="utility:list"
onclick={togglePromotionList}>
</lightning-button>
</cgcloud-tpm-trade-planning>
