How can we create a custom element type in Drupal 8 webform module?

  • I have figured it out how it will be... I'm little busy now. Will post the answer here in some time. It will help others in future.
    – Cool
    May 30, 2017 at 6:28
  • Please post the answer as a recipe here drupal.org/docs/8/modules/webform/webform-cookbook
    – jrockowitz
    May 30, 2017 at 10:51
  • @ARUN can you post it? I've been searching and no luck yet.
    – Kartagis
    Jul 12, 2017 at 13:02

1 Answer 1


There are many example module in the webform module itself, and three examples of custom elements all quite clear and detailed:

  • Composite element - webform/modules/webform_example_composite
  • Element - webform/modules/webform_example_element
  • Handler - 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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.