Skip to content

Header Component

Overview

A report header can be created by combining other components such as text or image. A header may be included only on the first page of a report, on each page after the first, or on every page of the report.

Schema

key type required description
type string required A string defining the component type as a Header.
components Component[] required An array of components that will make up the layout of the header.
dataQuery string optional A JSONata query to use as the data source for this component and all child components. If repeating is true, the query must resolve to an array of objects in order to repeat components in components.
repeating boolean optional If true, all components defined in components will repeat for each element in the array returned by dataQuery. Default is true.
pageBreak boolean optional A boolean indicating whether to add a page break after each repeated group of components. Default is false.
sectionName string optional Marks the component, its contents, and any sub-components as a named section in the report. A section can span multiple pages. The first, last and page count of a section can be inserted into the report using tokens: e.g. $(SECTION_BEGIN_[section-name]), $(SECTION_END_[section-name]) and $(SECTION_COUNT_[section-name]).
sectionLink string optional If defined, the entire component will become a link to a named section in the report. The link will redirect the user to the beginning of the named section in the report.
debug DebugOptions optional Enables highlighting of this component in the report. Useful for debugging layout issues.
style string or Style optional Either a style identifier or a style object used to define the layout/styling options for the component. Any textOptions in the style are ignored for this component. For a more detailed explanation of the style system, see Styles.
condition Conditional optional The component will not be rendered in the report if a condition is present and it evaluates to false. For more information on conditions, see Conditionals.

Examples

Basic header

{
    "type": "Header",
    "components": [
        {
            "type": "Text",
            "text": "Sales Report",
            "style": "header"
        }
    ]
}

First page only header

{
    "type": "Header",
    "components": [
        {
            "type": "Text",
            "text": "Sales Report",
            "style": {
                "layoutOptions": {
                    "showOnce": true
                }
            }
        }
    ]
}

Different headers on first page and rest of report

{
    "components": [
        {
            "type": "Header",
            "components": [
                {
                    "type": "Text",
                    "text": "Sales Report",
                    "style": {
                        "layoutOptions": {
                            "showOnce": true
                        }
                    }
                }
            ]
        },
        {
            "type": "Header",
            "components": [
                {
                    "type": "Text",
                    "text": "Report Details",
                    "style": {
                        "layoutOptions": {
                            "skipOnce": true
                        }
                    }
                }
            ]
        }
    ]
}