Custom Element Processors
The custom elements module comes with Custom element processors that try to implement a reasonable default for content entities and fields. These defaults can be further customized with custom modules as needed.
The default entity processor renders the data of all visible fields either as attribute to the custom element tag, or as nested markup via a slot. The module maps simple fields and their properties to attributes and falls back to rendering more complex fields to regular markup, which gets added as slot to the parent custom element.
This method was the default in version 2.x and since 3.x, it's used when "Use automatic processing" is enabled in the Custom Elements display. Besides that, when "Auto" is selected for individual fields the field is formatted using processors.
Processors are provided via services, for example see TextFieldItemProcessor as registered at the services.yml file.
Providing blocks
In order to provide blocks that render into custom elements, for example for using as part of the Layout Builder, the block cannot directly return a custom element object, since its interface requires a render array. Instead, simply return the custom element as render array via its helper toRenderArray(). When done so, the custom element is going to be picked up correctly when the layout is rendered.
Adding Drupal forms
Lupus Decoupled Drupal supports submitting Drupal forms via the decoupled frontend, as documented under Advanced Topics - Drupal Forms. In order to enable submitting another Drupal form on the frontend, a custom-elements enabled form processing route must be added. This is done easily by: