---
title: "DocHeaderComponent"
manual: "TYPO3 Explained"
version: "12.4"
permalink: "https://docs.typo3.org/permalink/t3coreapi:docheadercomponent@12.4"
source: "ApiOverview/Backend/BackendModules/DocHeaderComponent.rst"
rendered: "2026-10-21T15:29:37+00:00"
---

> [!WARNING]
> **Attention**
>
> TYPO3 v12 has reached end-of-life as of April 30th 2026 and
> is no longer being maintained. Use the version switcher on the top
> left of this page to select documentation for a supported version of TYPO3.
>
> Need more time before upgrading?
> You can purchase Extended Long Term Support (ELTS) for TYPO3 v12 here:
> [TYPO3 ELTS](https://typo3.com/services/extended-support-elts).

# DocHeaderComponent {#docheadercomponent}

The `\TYPO3\CMS\Backend\Template\Components\DocHeaderComponent` can be
used to display a standardized header section in a backend module with buttons,
menus etc. It can also be used to hide the header section in case it is
not desired to display it.

![](../../../Images/ManualScreenshots/Backend/DocHeaderComponent.png)

You can get the `DocHeaderComponent` with
[\\TYPO3\\CMS\\Backend\\Template\\ModuleTemplate::getDocHeaderComponent](https://docs.typo3.org/permalink/t3coreapi:typo3-cms-backend-template-moduletemplate-getdocheadercomponent@12.4)
from your module template.

**Table of contents**

-   [DocHeaderComponent API](https://docs.typo3.org/permalink/t3coreapi:docheadercomponent-api@12.4)
-   [Example: Build a module header with buttons and a menu](https://docs.typo3.org/permalink/t3coreapi:example-build-a-module-header-with-buttons-and-a-menu@12.4)

## DocHeaderComponent API {#docheadercomponent-api}

It has the following methods:

-   **class DocHeaderComponent**

    -   *Fully qualified name:* `\TYPO3\CMS\Backend\Template\Components\DocHeaderComponent`

    DocHeader component class

    -   **setMetaInformation(array $metaInformation)**

        Set page information

        -   *param $metaInformation:* Record array

    -   **setMetaInformationForResource(\\TYPO3\\CMS\\Core\\Resource\\ResourceInterface $resource)**

        -   *param $resource:* the resource

    -   **getMenuRegistry()**

        Get moduleMenuRegistry

        *Returns:* `MenuRegistry`

    -   **getButtonBar()**

        Get ButtonBar

        *Returns:* `ButtonBar`

    -   **isEnabled()**

        Determines whether this components is enabled.

        *Returns:* `bool`

    -   **enable()**

        Sets the enabled property to TRUE.

    -   **disable()**

        Sets the enabled property to FALSE (disabled).

    -   **docHeaderContent()**

        Returns the abstract content of the docHeader as an array

        *Returns:* `array`

## Example: Build a module header with buttons and a menu {#docheadercomponent-example}

The following example is extracted from the example Extbase extension
[EXT:blog_example](https://extensions.typo3.org/extension/blog_example). See the complete source code at
[t3doc/blog-example (GitHub)](https://github.com/TYPO3-Documentation/blog_example).

We use the DocHeaderComponent to register buttons and a menu to the module
header.

**Class T3docs\\BlogExample\\Controller\\BackendController**

```php
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Backend\Template\ModuleTemplate;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Type\Bitmask\Permission;

class BackendController extends ActionController
{
    private function modifyDocHeaderComponent(ModuleTemplate $view): void
    {
        $context = '';
        $menu = $this->buildMenu($view, $context);

        $buttonBar = $view->getDocHeaderComponent()->getButtonBar();
        $this->addPopulateButton($buttonBar);
        $this->addShortCutButton($buttonBar);
        $this->addReloadButton($buttonBar);

        $view->getDocHeaderComponent()->getMenuRegistry()->addMenu($menu);
        $view->setTitle(
            $this->getLanguageService()->sL('LLL:EXT:blog_example/Resources/Private/Language/Module/locallang_mod.xlf:mlang_tabs_tab'),
            $context,
        );

        $permissionClause = $GLOBALS['BE_USER']->getPagePermsClause(Permission::PAGE_SHOW);
        $pageRecord = BackendUtility::readPageAccess(
            $this->pageUid,
            $permissionClause,
        );
        if ($pageRecord) {
            $view->getDocHeaderComponent()->setMetaInformation($pageRecord);
        }
    }

    protected function initializeModuleTemplate(
        ServerRequestInterface $request,
    ): ModuleTemplate {
        $view = $this->moduleTemplateFactory->create($request);

        $this->modifyDocHeaderComponent($view);
        $view->setFlashMessageQueue($this->getFlashMessageQueue());

        return $view;
    }
}
```
