I am not sure if youThere are looking for a composite element or just a simple one, but I found a great example for a Composite element posted by the user lpalgarvio.
Using themany example module makes it all simple, in this case you are extending the class WebformCompositeBase
to implement your own composite element.
Another example would be to take a look at the elements which ship with Webform module and how each is implemented. According to the webform 5 (D8) module maintainer he is wanting to add such an example into the webforms module.
Update:
There areitself, and three examples of custom elements in the webform module itself, all quite clear and detailed:
- Composite elementComposite element - webform/modules/webform_example_composite
- ElementElement - webform/modules/webform_example_element
- HandlerHandler - webform/modules/webform_example_remote_post
- Config examples - webform/modules/webform_examples (pre-built forms)
Using the example module makes it all simple, in this case you are extending the class WebformCompositeBase
to implement your own composite element.