Component

Admin layout

A layout to be used by admin applications

Typically you’ll use this together with the layout header component and the layout footer component.

Because it is an entire HTML document, this component can only be previewed on a separate page.

Search for usage of this component on GitHub.

How it looks (preview) (preview all)

<!DOCTYPE html>
<html lang="en" class="govuk-template">
  <head>
    <meta charset="utf-8" />
    <title>A page title - GOV.UK Publishing</title>
    <meta name="robots" content="noindex,nofollow,noimageindex">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="csrf-param" content="authenticity_token" />
<meta name="csrf-token" content="rb9tdy1QxiPAnKFlGYUg2M2cJqaFF-yKSQj9huGcjsUziyksJFw7xqlXViDRs5I2W9nV5wUGXENkF9f_1soy3g" />
    <link rel="icon" type="image/x-icon" href="/assets/content-publisher/govuk_publishing_components/favicon-production-e0de5a19794718059fac0d33d2a76a9224571294ae1105f8346aa484bb119926.png" />
    <link rel="stylesheet" href="/assets/content-publisher/application-c4d0c30c2b0e4b53d931ca27b3292eff652ec487fafdc67d41a04530dd3a7b92.css" media="all" />
    <script src="/assets/content-publisher/govuk_publishing_components/vendor/modernizr-249c9d6e99b31161d8e6ffe2279f04d061ee22afa2eef5e8976d1677303cb370.js"></script>
    
  </head>
  <body class="gem-c-layout-for-admin govuk-template__body">
    <script>
//<![CDATA[
      document.body.className += ' js-enabled' + ('noModule' in HTMLScriptElement.prototype ? ' govuk-frontend-supported' : '');

//]]>
</script>    
      <!-- You probably want to use the header, main & footer components here -->


      <script src="/assets/content-publisher/application-7da97c51c64a13c6c8cc6f82925d86b4370951be515282c12a20b596db1fd49e.js"></script>
  </body>
</html>

How to call this component

<%= render "govuk_publishing_components/components/layout_for_admin", {
  environment: "production",
  product_name: "Publishing",
  browser_title: "A page title"
} do %>
  <!-- You probably want to use the header, main & footer components here -->
<% end %>

Accessibility acceptance criteria

The layout template must:

  • have a lang attribute
  • contain a skip link
  • have a sensible page <title>

Other examples

With custom js filename (preview)

An alternative JS filename can be used in place of the default application.js if required (note that this cannot easily be demonstrated here).

<!DOCTYPE html>
<html lang="en" class="govuk-template">
  <head>
    <meta charset="utf-8" />
    <title>A page title - GOV.UK Publishing</title>
    <meta name="robots" content="noindex,nofollow,noimageindex">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="csrf-param" content="authenticity_token" />
<meta name="csrf-token" content="OYaTIySsmwuAdkDUgaVB_9patHRh7KFNHPQIUbRkeeGnstd4LaBm7um9t5FJk_MRTB9HNeH9EYQx6yIogzLF-g" />
    <link rel="icon" type="image/x-icon" href="/assets/content-publisher/govuk_publishing_components/favicon-production-e0de5a19794718059fac0d33d2a76a9224571294ae1105f8346aa484bb119926.png" />
    <link rel="stylesheet" href="/assets/content-publisher/application-c4d0c30c2b0e4b53d931ca27b3292eff652ec487fafdc67d41a04530dd3a7b92.css" media="all" />
    <script src="/assets/content-publisher/govuk_publishing_components/vendor/modernizr-249c9d6e99b31161d8e6ffe2279f04d061ee22afa2eef5e8976d1677303cb370.js"></script>
    
  </head>
  <body class="gem-c-layout-for-admin govuk-template__body">
    <script>
//<![CDATA[
      document.body.className += ' js-enabled' + ('noModule' in HTMLScriptElement.prototype ? ' govuk-frontend-supported' : '');

//]]>
</script>    
      <!-- You probably want to use the header, main & footer components here -->


      <script src="/assets/content-publisher/application-7da97c51c64a13c6c8cc6f82925d86b4370951be515282c12a20b596db1fd49e.js"></script>
  </body>
</html>
<%= render "govuk_publishing_components/components/layout_for_admin", {
  environment: "production",
  product_name: "Publishing",
  browser_title: "A page title",
  js_filename: "application"
} do %>
  <!-- You probably want to use the header, main & footer components here -->
<% end %>

With custom js filename for es6 components (preview)

An alternative JS filename can be used in place of the default es6-components.js if required (note that this cannot easily be demonstrated here).

<!DOCTYPE html>
<html lang="en" class="govuk-template">
  <head>
    <meta charset="utf-8" />
    <title>A page title - GOV.UK Publishing</title>
    <meta name="robots" content="noindex,nofollow,noimageindex">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="csrf-param" content="authenticity_token" />
<meta name="csrf-token" content="ShPw2mgL442B5VlMHtDXRoQeYPFCPjgBMmGlrJ4fO5rUJ7SBYQceaOgurgnW5mWoEluTsMIviMgffo_VqUmHgQ" />
    <link rel="icon" type="image/x-icon" href="/assets/content-publisher/govuk_publishing_components/favicon-production-e0de5a19794718059fac0d33d2a76a9224571294ae1105f8346aa484bb119926.png" />
    <link rel="stylesheet" href="/assets/content-publisher/application-c4d0c30c2b0e4b53d931ca27b3292eff652ec487fafdc67d41a04530dd3a7b92.css" media="all" />
    <script src="/assets/content-publisher/govuk_publishing_components/vendor/modernizr-249c9d6e99b31161d8e6ffe2279f04d061ee22afa2eef5e8976d1677303cb370.js"></script>
    
  </head>
  <body class="gem-c-layout-for-admin govuk-template__body">
    <script>
//<![CDATA[
      document.body.className += ' js-enabled' + ('noModule' in HTMLScriptElement.prototype ? ' govuk-frontend-supported' : '');

//]]>
</script>    
      <!-- You probably want to use the header, main & footer components here -->


      <script src="/assets/content-publisher/application-7da97c51c64a13c6c8cc6f82925d86b4370951be515282c12a20b596db1fd49e.js"></script>
  </body>
</html>
<%= render "govuk_publishing_components/components/layout_for_admin", {
  environment: "production",
  product_name: "Publishing",
  browser_title: "A page title",
  js_module_filename: "es6-bundle"
} do %>
  <!-- You probably want to use the header, main & footer components here -->
<% end %>

With custom css filename (preview)

An alternative JS filename can be used in place of the default application.scss if required (note that this cannot easily be demonstrated here).

<!DOCTYPE html>
<html lang="en" class="govuk-template">
  <head>
    <meta charset="utf-8" />
    <title>A page title - GOV.UK Publishing</title>
    <meta name="robots" content="noindex,nofollow,noimageindex">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="csrf-param" content="authenticity_token" />
<meta name="csrf-token" content="nk2jTPVoiw_4wQ-hHFfbiZ5WJzzNRqmPe2BLbBs09iUAeecX_GR26pEK-OTUYWlnCBPUfU1XGUZWf2EVLGJKPg" />
    <link rel="icon" type="image/x-icon" href="/assets/content-publisher/govuk_publishing_components/favicon-production-e0de5a19794718059fac0d33d2a76a9224571294ae1105f8346aa484bb119926.png" />
    <link rel="stylesheet" href="/assets/content-publisher/application-c4d0c30c2b0e4b53d931ca27b3292eff652ec487fafdc67d41a04530dd3a7b92.css" media="all" />
    <script src="/assets/content-publisher/govuk_publishing_components/vendor/modernizr-249c9d6e99b31161d8e6ffe2279f04d061ee22afa2eef5e8976d1677303cb370.js"></script>
    
  </head>
  <body class="gem-c-layout-for-admin govuk-template__body">
    <script>
//<![CDATA[
      document.body.className += ' js-enabled' + ('noModule' in HTMLScriptElement.prototype ? ' govuk-frontend-supported' : '');

//]]>
</script>    
      <!-- You probably want to use the header, main & footer components here -->


      <script src="/assets/content-publisher/application-7da97c51c64a13c6c8cc6f82925d86b4370951be515282c12a20b596db1fd49e.js"></script>
  </body>
</html>
<%= render "govuk_publishing_components/components/layout_for_admin", {
  environment: "production",
  product_name: "Publishing",
  browser_title: "A page title",
  css_filename: "application"
} do %>
  <!-- You probably want to use the header, main & footer components here -->
<% end %>

With type module (preview)

Adds ‘type=module’ to the javascript_include_tag. By default, use_type_module is false.

<!DOCTYPE html>
<html lang="en" class="govuk-template">
  <head>
    <meta charset="utf-8" />
    <title>A page title - GOV.UK Publishing</title>
    <meta name="robots" content="noindex,nofollow,noimageindex">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="csrf-param" content="authenticity_token" />
<meta name="csrf-token" content="FC-goPWfIPi1FF9bGZ6MnUzrvLC43qw3sFuDCFQ7vryKG-T7_JPdHdzfqB7RqD5z2q5P8TjPHP6dRKlxY20Cpw" />
    <link rel="icon" type="image/x-icon" href="/assets/content-publisher/govuk_publishing_components/favicon-production-e0de5a19794718059fac0d33d2a76a9224571294ae1105f8346aa484bb119926.png" />
    <link rel="stylesheet" href="/assets/content-publisher/application-c4d0c30c2b0e4b53d931ca27b3292eff652ec487fafdc67d41a04530dd3a7b92.css" media="all" />
    <script src="/assets/content-publisher/govuk_publishing_components/vendor/modernizr-249c9d6e99b31161d8e6ffe2279f04d061ee22afa2eef5e8976d1677303cb370.js"></script>
    
  </head>
  <body class="gem-c-layout-for-admin govuk-template__body">
    <script>
//<![CDATA[
      document.body.className += ' js-enabled' + ('noModule' in HTMLScriptElement.prototype ? ' govuk-frontend-supported' : '');

//]]>
</script>    
      <!-- You probably want to use the header, main & footer components here -->


      <script src="/assets/content-publisher/application-7da97c51c64a13c6c8cc6f82925d86b4370951be515282c12a20b596db1fd49e.js" type="module"></script>
  </body>
</html>
<%= render "govuk_publishing_components/components/layout_for_admin", {
  environment: "production",
  product_name: "Publishing",
  browser_title: "A page title",
  use_type_module: true
} do %>
  <!-- You probably want to use the header, main & footer components here -->
<% end %>