Answers.Body: <p>Consider using:</p>
  <pre class="lang-php prettyprint-override"><code>return $this-&gt;asCpScreen()
              -&gt;title('dashboard')
              -&gt;contentTemplate('startupstirling/cp/charges/index');
  </code></pre>
  <p>removing blocks from your template so it's just the content:</p>
  <pre><code>hello
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-13T21:29:06.450Z
Answers.LastActivityDate: 2022-12-13T21:29:06.450Z
Answers.UserDisplayName: Leevi Graham
Body: <p>First time building a custom control panel dashboard for a module.</p>
  <p>Template loads ok but is unstyled and not loading JS that the rest of the control panel screens do.</p>
  <pre><code>{% extends &quot;_layouts/cp&quot; %}
  {% set title = &quot;Dashboard&quot;|t %}
  
  {% block content %}
      hello
  {% endblock %}
  </code></pre>
  <p>what have I missed from <a href="https://craftcms.com/docs/4.x/extend/cp-templates.html#page-templates" rel="nofollow noreferrer">https://craftcms.com/docs/4.x/extend/cp-templates.html#page-templates</a></p>
  <p>the controller for this looks like</p>
  <pre><code>return Craft::$app-&gt;view-&gt;renderTemplate('module/cp/charges/index');
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-12-13T09:52:27.323Z
Comments.Text: props to Leevi Graham who suggested doing return $this->asCpScreen()
              ->title('Charges')
              ->contentTemplate('module/cp/charges/index'); and works fine.
Comments.UserDisplayName: Steven Grant
Tags: <templating><modules>
Title: extending the Craft control panel templates are unstyled
ThreadText: # extending the Craft control panel templates are unstyled
  
  (Asked by: username_0 on 2022-12-12)
  
  First time building a custom control panel dashboard for a module.
  
  Template loads ok but is unstyled and not loading JS that the rest of the control panel screens do.
  
  ```
  {% extends "_layouts/cp" %}
  {% set title = "Dashboard"|t %}
  
  {% block content %}
      hello
  {% endblock %}
  
  ```
  
  what have I missed from <https://craftcms.com/docs/4.x/extend/cp-templates.html#page-templates>
  
  the controller for this looks like
  
  ```
  return Craft::$app->view->renderTemplate('module/cp/charges/index');
  
  ```
  
  **Tags:** templating, modules
  
  > **Comments:**
  > **username_0**: props to username_1 who suggested doing return $this->asCpScreen()             ->title('Charges')             ->contentTemplate('module/cp/charges/index'); and works fine.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-12-13. Score: 3 | Accepted answer
  
  Consider using:
  
  ```php
  return $this->asCpScreen()
              ->title('dashboard')
              ->contentTemplate('startupstirling/cp/charges/index');
  
  ```
  
  removing blocks from your template so it's just the content:
  
  ```
  hello
  
  ```
  
  
  ---
  
  