Developer Programs

Learn

Docs

Header

Components > Application Layout > Header
Use this component to...
Contain your app’s header elements

Overview

This is a header in a responsive application, with the other sections darkened for contrast.
Application layout header

The header component displays at the top of your application.

It includes:

  • A left section that displays the hamburger button and your app title
  • A search box in the middle
  • A right section for displaying admin options and any environmental context.

Development

Web component development

Component reference

rui-header
rui-header
Module: rui-header - Package: @jkhy/responsive-ui-wc

Application header bar; contains rui-header-left and rui-header-right sections

NameTypeDefaultDescription
displaySearchbooleanfalseSet this to true to display a search box in the header. Note that the search box does not display at mobile size.
searchWidthstring'50%'

Specifies the width of the search box. Use CSS notation appropriate for the “size” CSS attribute. All width in the header that isn’t used by rui-header-left and rui-header-right is reserved for the search box.

  • Use a percentage value to set the search box’s width as a percentage of the width available in the center section. For example, use a value of “100%” to have the search box take all width available in the center section, or use a value of “50%” to have the search box take half the width available in the center section. We recommend using a value of “50%” in most cases since that provides a nice level of responsiveness; this is the default value.
  • Use a pixel value to set the search box’s width to a fixed pixel width. For example, use a value of “400px” to have the search box always have a width of 400 pixels, regardless of the space available in the center section. Using a fixed approach can result in your header content not fitting within the available width.
  • You can use the value auto to set the search box’s width to just the space needed to display the search box, although this doesn’t always produce the best results. It’s generally better to use a percentage or pixel value to set the width for the search box.
searchWatermarkTextstring'SEARCH'The watermark text displayed in the search box until the user enters search text. We recommend using an upper-case value for the watermark text in most cases.
clearOnSearchbooleantrueClear the user’s search text from the header search box after a search is initiated?
isHiddenbooleanfalseSet this to true if your application should not display a header. This should be extremely rare for any Jack Henry application.
rui-header-searcheventEvent fired when the user presses the enter key or the search button within the search box. The search text is passed in the custom event’s detail.
rui-header-left
rui-header-left
Module: rui-header - Package: @jkhy/responsive-ui-wc

Left section within header bar; contains hamburger button, optional back button, and header title

NameTypeDefaultDescription
displayBackButtonbooleanfalseSet this to true if you want to provide back button functionality when your app is not running within a browser, such as in Xperience or Electron.
rui-back-button-clickeventEvent fired when the user presses the back button.
rui-header-right
rui-header-right
Module: rui-header - Package: @jkhy/responsive-ui-wc

Right section within header bar; contains admin options

NameTypeDefaultDescription
displayLightDarkModeSelectorbooleantrueSpecifies whether to include a dropdown at the far right edge of the header that allows the user to switch between always using light mode, always using dark mode, or using the device setting for light/dark mode.

Implementation

Begin by importing the rui-header module into your application.

Import the module
// import into app.module
import '@jkhy/responsive-ui-wc/components/rui-header/rui-header-imports';

Then define the header within your main-header component.

  • Use a rui-header tag as the outermost element in that view.
  • Within the rui-header tag:
    • Nest a rui-header-left tag to contain elements on the left side of the header.
      • The left side of the header automatically displays the hamburger button; you don’t have to do anything to get that.
      • The left side also typically displays your application name.
    • Nest a rui-header-right tag to contain elements on the right side of the header.
      • The right side of the header is typically used to display header buttons, header dropdowns, and header mega menus.
Don’t nest any elements within rui-header that are not contained within either rui-header-left or rui-header-right.
Using the component
<!-- Header: Defines application name and admin options that display in header -->
<rui-header [displaySearch]="true" searchWidth="50%" searchWatermarkText="SEARCH" (rui-header-search)="search($event)">

    <!-- Left side -->
    <rui-header-left [displayBackButton]="displayBackButton" (rui-back-button-click)="backButtonClicked()">

        <!-- Left side content -->

    </rui-header-left>

    <!-- Right side -->
    <rui-header-right>

        <!-- Right side content -->

    </rui-header-right>

</rui-header>

Angular wrapper development

Wrapper reference

jha-header
jha-header
Module: JhaHeaderModule - Package: @jkhy/responsive-ui-angular

Application header bar; contains jha-header-left and jha-header-right sections

NameTypeDefaultDescription
jhaDisplaySearchbooleanfalseSet this to true to display a search box in the header. Note that the search box does not display at mobile size.
jhaSearchWidthstring'50%'

Specifies the width of the search box. Use CSS notation appropriate for the “size” CSS attribute. All width in the header that isn’t used by jha-header-left and jha-header-right is reserved for the search box.

  • Use a percentage value to set the search box’s width as a percentage of the width available in the center section. For example, use a value of “100%” to have the search box take all width available in the center section, or use a value of “50%” to have the search box take half the width available in the center section. We recommend using a value of “50%” in most cases since that provides a nice level of responsiveness; this is the default value.
  • Use a pixel value to set the search box’s width to a fixed pixel width. For example, use a value of “400px” to have the search box always have a width of 400 pixels, regardless of the space available in the center section. Using a fixed approach can result in your header content not fitting within the available width.
  • You can use the value auto to set the search box’s width to just the space needed to display the search box, although this doesn’t always produce the best results. It’s generally better to use a percentage or pixel value to set the width for the search box.
jhaSearchWatermarkTextstring'SEARCH'The watermark text displayed in the search box until the user enters search text. We recommend using an upper-case value for the watermark text in most cases.
jhaIsHiddenbooleanfalseSet this to true if your application should not display a header. This should be extremely rare for any Jack Henry application.
jhaSearcheventEvent fired when the user presses the enter key or the search button within the search box. This event passes the search text as a string parameter to the event handler.
jha-header-left
jha-header-left
Module: JhaHeaderModule - Package: @jkhy/responsive-ui-angular

Left section within header bar; contains hamburger button, optional back button, and header title

NameTypeDefaultDescription
jhaDisplayBackButtonbooleanfalseSet this to true if you want to provide back button functionality when your app is not running within a browser, such as in Xperience or Electron.
jhaBackButtonClickedeventEvent fired when the user presses the back button.
jhaNavToggledeventEvent fired when the user presses the hamburger button. The event provides one string argument with a value of either “Expanded” or “Collapsed”, indicating the new state for the nav bar.
jha-header-right
jha-header-right
Module: JhaHeaderModule - Package: @jkhy/responsive-ui-angular

Right section within header bar; contains admin options

NameTypeDefaultDescription
jhaDisplayLightDarkModeSelectorbooleantrueSpecifies whether to include a dropdown at the far right edge of the header that allows the user to switch between always using light mode, always using dark mode, or using the device setting for light/dark mode.

Implementation

Begin by importing the JhaHeaderModule into your application.

Import the module
// import into app.module
import { JhaHeaderModule } from '@jkhy/responsive-ui-angular/jha-header';

@NgModule({
    imports: [JhaHeaderModule,...]
})

export class AppModule(){}

Then define the header within your main-header component.

  • Use a jha-header tag as the outermost element in that view.
  • Within the jha-header tag:
    • Nest a jha-header-left tag to contain elements on the left side of the header.
      • The left side of the header automatically displays the hamburger button; you don’t have to do anything to get that.
      • The left side also typically displays your application name.
    • Nest a jha-header-right tag to contain elements on the right side of the header.
      • The right side of the header is typically used to display header buttons, header dropdowns, and header mega menus.
Don’t nest any elements within jha-header that are not contained within either jha-header-left or jha-header-right.
Using the component
<!-- Header: Defines application name and admin options that display in header -->
<jha-header [jhaIsHidden]="hideHeader" jhaDisplaySearch="true" jhaSearchWidth="50%"
 jhaSearchWatermarkText="SEARCH" (jhaSearch)="search($event)">

    <!-- Left side -->
    <jha-header-left [jhaDisplayBackButton]="displayBackButton" (jhaBackButtonClicked)="backButtonClicked()">

        <!-- Left side content -->

    </jha-header-left>

    <!-- Right side -->
    <jha-header-right>

        <!-- Right side content -->

    </jha-header-right>

</jha-header>

Dynamically hiding and showing header elements

You can dynamically hide and show elements in the header, based on two different kinds of criteria:

  • Screen Width: Part of responsive layout is adjusting screen elements accordingly to fit the screen width.
    • Use CSS media query classes to cover application-specific breakpoints.
    • For example, say the elements in the left side of your header start to collide with elements in the right side of your header at 876 pixels. You can add your own application-specific classes that define one layout at 877 pixels and define a different layout at 876 pixels and less.
  • Contextual Data: Sometimes you need to hide or display elements based on contextual criteria, such as whether the user is logged in yet or whether the user has access to certain features in the app.
    • In Angular, use the *ngIf directive to conditionally display elements based on data in your controller.

Component playground


Design

Figma design

Figma design info
You can find this component in the Components - Application Layout page in the Figma UI Kit.
Dev ComponentDesign Component Name
Header barRUI / Header / Header Bar
Search box in headerRUI / Header / Search

Adobe XD design

Adobe XD design info
You can find this component in these artboards in the Adobe XD design samples:
  • Layout - Header, Expanded Nav, Function View
  • Layout - Header, Collapsed Nav, Function View
  • Layout - Nav Elements - Expanded Nav Bar
  • Layout - Nav Elements - Collapsed Nav Bar
  • Layout - Nav Mega Menu
  • Layout - Header Elements – Basics
  • Layout - Header Menu Buttons
  • Layout - Header Mega Menu
  • Layout - Mobile Application
  • Layout - Tablet Application – Portrait
  • Layout - Tablet Application - Landscape
Dev ComponentDesign Component Name
Header barJHA / Header / Header Bar
Search box in headerJHA / Header / Search

Support options
Have questions on this topic?
Join the Responsive UI team in Microsoft Teams to connect with the community.
See something in this page that needs to change?
Send us feedback on this page.
Last updated Wed Sep 25 2024