How to programmatically render a contact form in a theme in D8 How to get the side-wide contact form (feedback) individually displayed in a custom block or other page then /contact (e.g. frontpage)?

I've tried this code, but it is not working (are contact forms entities?):

// get default form
// get the entity object
$default_form = \Drupal::config('contact.settings')-&gt;get('default_form');
$entity = \Drupal::entityManager()-&gt;getStorage('contact_form')-&gt;load($default_form);

// get view builder
// render view
$view_builder = \Drupal::entityManager()-&gt;getViewBuilder('contact_form');
$full_output = $view_builder-&gt;view($entity);
Contact form is an entity, but you can't view it.

What you want instead is an add form of a contact_message with contact_form as bundle.

See ContactController::contactSitePage() (EDIT: API docs) as example:

$message = \Drupal::entityTypeManager()
  -&gt;getStorage('contact_message')
  -&gt;create(array(
    'contact_form' =&gt; $contact_form-&gt;id(),
  ));

// This works in a controller, use \Drupal::service('entity.form_builder') elsewhere.
$form = $this-&gt;entityFormBuilder()-&gt;getForm($message);
$form['#title'] = SafeMarkup::checkPlain($contact_form-&gt;label());


EDIT (thanks @nilsun): Note that entityManager is deprecated in favour of entityTypeManager.