You can add your own draggable components to the builder without changing the managed package. A custom component is a web component you publish as a static resource, plus a Portal_Block__mdt custom metadata record that tells the builder how to present and configure it.
index.js that registers the element (for example customElements.define('my-widget', ...)). LWC OSS components are exposed through their CustomElementConstructor, exactly like the standard components.b3p__Portal_Block__mdt record that points at the resource and tag and declares the editable attributes.Write a self contained web component. Read runtime context from window.globals (siteUrl, sessionKey, userType, editor). See Technical architecture and request flow. Build it into a Salesforce static resource whose top level index.js registers the custom element. Deploy the static resource to the org.
Create a Portal_Block__mdt record. Key fields:
| Field | Value |
|---|---|
Label |
The palette label |
DeveloperName |
Used to derive the block and component type names |
Category__c |
Interactions, Onboarding, Compliance, Data, UI, or UX |
Web_Component_Tag__c |
The custom element tag, for example my-widget |
JS_Resource__c |
The static resource name that contains the component index.js |
Traits_JSON__c |
3B Portals trait config describing the editable attributes |
Order__c |
Position in the palette |
Load_Immediately__c |
Check for libraries or shared code that must load first |
Draggable__c, Droppable__c, Editable__c, Highlightable__c, Removable__c, Stylable__c |
3B Portals component flags |
Description__c |
An AI description so the AI builder can use the block |
Is_Deprecated__c |
Check to hide from the palette |
For a simple markup only block, leave Web_Component_Tag__c and JS_Resource__c empty and put raw HTML in HTML__c instead.
Traits_JSON__c is a JSON array of 3B Portals traits that becomes the properties panel for the block. Each trait name maps to the kebab case HTML attribute your component reads. Example:
[
{ "type": "text", "name": "title", "label": "Title" },
{ "type": "text", "name": "record-id", "label": "Record Id", "value": "{{contactUser.Id}}" },
{ "type": "key-value", "name": "component-params", "label": "Parameters" }
]
Every registered component also supports conditional display. Trait values can be merge tags, for example {{contactUser.Id}} or {{record.Name}}.
When the builder opens, it:
Portal_Block__mdt record, ordered by Order__c.Web_Component_Tag__c, it registers a 3B Portals component type named <DeveloperName>-component using the tag, mapping the boolean flags to 3B Portals options, and building traits from Traits_JSON__c. It then adds a palette block <DeveloperName>-block that drops that component type.HTML__c, it adds a block that inserts the raw markup.From 12.0.0, the builder waits for custom block registration before opening a saved page. It also repairs elements saved as text or without a component type when their tag matches a registered component.
If a custom component appeared as Text with missing settings in an older version, open the page in the upgraded builder and save it once. The repair preserves saved attributes, so you do not need to delete and add the component again. If settings are still missing, check that the Portal Block record is not deprecated and that Web_Component_Tag__c matches the saved element's tag.
JS_Resource__c index.js into the canvas, so the custom element upgrades and renders live while editing.If the portal has offline support enabled, a custom component that calls Apex should opt in to caching and background sync so it behaves like the standard components. In short: post to the router REST endpoint with the session key in the body, add an X-Portal-Cache-Key header to reads you are happy to serve from a device cache, add X-Portal-Sync: 1 to writes that are safe to send later, and listen for background refreshes and replayed writes.
A component that does none of this still works. Its reads simply are not cached and its writes fail while the device is offline, as before.
The headers, request and response examples, the broadcast channel and the events are all in Component caching and offline API.
Web_Component_Tag__c must match the tag your resource defines.component-params (the key value trait) to pass dynamic bindings, and merge tags for record data.Load_Immediately__c for shared libraries other components depend on.default values are applied as element attributes when a component is dropped. Components should still provide sensible internal defaults so manually authored markup remains robust.