In drupal 7 we used to attach a webform to nodes and then we could render them as a block, nowadays in drupal 8 Webform is a dependent entity and is designed and developed on its own. now my question is :

I've created a webform and now I want to place it in a block so user can simply fill it up in front page, How can I show a webform as a Block?

  • 10
    By default, Webform block will be available in the block layout, once you created the webform, Just place the webform block in the any region. and then configure it and choose the particular webform which you created Commented Feb 1, 2018 at 7:30

4 Answers 4


Special thanks to Peacog Web Development for their great tutorial .Here is the tip:

Rather than Drupal 7, Different Block types can be created by admin

so the solution is simple :

  • Create a new block type using : admin/structure/block/block-content/types
  • Add a Reference of type Webform to custom block type
  • remove body if it's inappropriate
  • modify custom block Manage Display so the form would be rendered as webform
  • your new Block type is ready

now to add any new webform as block you, you will need to add new block of type Custom Block and refer to your webform, and that's done.

  • Using this method allowed me to embed this into a node using Entity Embed, which I couldn't do otherwise.
    – neuquen
    Commented Jul 16, 2019 at 19:30
  • 1
    logeshvaran/eigentor are correct, there is no need to create a custom block type.
    – wranvaud
    Commented Jul 27, 2021 at 18:26
  • Downvoting because this answer "reinvents the wheel", duplicating functionality that comes with the Webform module, which contains the WebformBlock class.
    – mbomb007
    Commented Nov 29, 2022 at 22:01

logeshvaran is correct: Webform for Drupal 8 already provides a block that can reference a webform. So no need to create a custom block type.

  • 3
    Make sure to search for "Webform" when placing the blocks, and then choose the Webform name in the dialog box provided. I've been searching for the name of the webform, that's why I couldn't find the block to place.
    – Randell
    Commented Jun 7, 2019 at 1:12
  • 1
    Thank you @Randell! To expound on his comment. The Block name is "Webform" and the Category is "Webform". After you select that block you will be able to choose which webform you want.
    – neuquen
    Commented Jul 16, 2019 at 18:13

From Drupal 8 admin

  1. Create your webform
  2. Structure => Block Layout => click "Place Block" under your preferred region
  3. Find Webform then => Place Block => under Webform type your webform title and it will find it
  4. Save Block

You are all set

  • 1
    Thanks @hzak for this straight-forward and step by step answer! Very useful, and quick to follow. Commented Mar 26, 2021 at 4:15

You can embed a webform programmatically:

$webform = $this->entityTypeManager->getStorage('webform')->load(self::WEBFORM_ID);
$build['content'][] = [
  '#type' => 'webform',
  '#webform' => $webform,

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.