Documentation and examples for Angular Header - a powerful, responsive navigation header. Includes support for branding, links, dropdowns, and more.
Available in Other JavaScript Frameworks
CoreUI Angular Header Component is also available for Bootstrap, React, and Vue. Explore framework-specific implementations below:
On this page
Supported content
Headers come with built-in support for a handful of sub-components. Choose from the following as needed:
cHeaderBrandfor your company, product, or project namecHeaderNavfor a full-height and lightweight navigation (including support for dropdowns)cHeaderTogglerfor use with navigation togglingcHeaderTextfor adding vertically centered strings of textcHeaderDividerto separate subheaders- Flex and spacing utilities for any form controls and actions
Examples
Here’s an example of all the sub-components included in a responsive light-themed header that automatically collapses at the lg (large) breakpoint.
import { Component } from '@angular/core';
import { RouterLink } from '@angular/router';
import {
ContainerComponent,
DropdownComponent,
DropdownDividerDirective,
DropdownItemDirective,
DropdownMenuDirective,
DropdownToggleDirective,
HeaderBrandComponent,
HeaderComponent,
HeaderDividerComponent,
HeaderNavComponent,
HeaderTextComponent,
NavItemComponent,
NavLinkDirective
} from '@coreui/angular';
@Component({
selector: 'docs-header-example',
templateUrl: './header-example.component.html',
styleUrls: ['./header-example.component.scss'],
imports: [
RouterLink,
ContainerComponent,
DropdownComponent,
DropdownDividerDirective,
DropdownItemDirective,
DropdownMenuDirective,
DropdownToggleDirective,
HeaderBrandComponent,
HeaderComponent,
HeaderDividerComponent,
HeaderNavComponent,
HeaderTextComponent,
NavItemComponent,
NavLinkDirective
]
})
export class HeaderExampleComponent {}<c-header>
<c-container fluid>
<c-header-brand [routerLink]>Brand</c-header-brand>
<c-header-nav class="ms-auto">
<c-nav-item>
<a [active]="true" [routerLink] cNavLink>Home</a>
</c-nav-item>
<c-nav-item>
<a cNavLink routerLink="/components/alert">Link</a>
</c-nav-item>
<c-nav-item>
<a cNavLink disabled routerLink="/components/alert">Disabled</a>
</c-nav-item>
<c-dropdown alignment="end">
<a cDropdownToggle cNavLink>Dropdown</a>
<ul cDropdownMenu>
<li><a [routerLink]="[]" cDropdownItem>Action</a></li>
<li><a [routerLink]="[]" cDropdownItem>Another action</a></li>
<li>
<hr cDropdownDivider>
</li>
<li><a [routerLink]="[]" cDropdownItem>Something else</a></li>
</ul>
</c-dropdown>
</c-header-nav>
</c-container>
<c-header-divider />
<c-container fluid>
<c-header-text>Additional text</c-header-text>
</c-container>
</c-header>.header-toggler-icon {
min-width: 25px;
}API reference
Header Module
import { HeaderModule } from '@coreui/angular';
@NgModule({
imports: [HeaderModule,]
})
export class AppModule() { }c-header
component
import { HeaderComponent } from '@coreui/angular'| Property | Default | Type |
|---|---|---|
| container | - | Container |
Defines optional container wrapping children elements | ||
| position | - | Positions |
Place header in non-static positions | ||
| role | 'banner' | string |
Default role for header | ||
c-header-brand
component
import { HeaderBrandComponent } from '@coreui/angular'c-header-nav
component
import { HeaderNavComponent } from '@coreui/angular'c-header-text
component
import { HeaderTextComponent } from '@coreui/angular'cHeaderToggler
directive
import { HeaderTogglerDirective } from '@coreui/angular'