App header API
Import
Section titled “Import”import { AppHeader, SimpleAuthTool } from '@cimpress-ui/react';Accessibility notes
Section titled “Accessibility notes”AppHeader is designed to be a banner landmark. Make sure that app header is a direct descendant of your application’s <body> element.
Header tools
Section titled “Header tools”AppHeader can render custom components (“tools”) provided in the tools prop. Tools allow the app header to be extensible, which in turn gives more freedom to various domains and teams that may have different needs.
import { AppHeader, IconButton } from '@cimpress-ui/react';import { IconBookOpen, IconSettingsCog } from '@cimpress-ui/react/icons';
export default function Demo() { return ( <AppHeader title="My app" titleLink={{ href: '#', target: '_self' }} tools={ <> <IconButton variant="tertiary" size="small" icon={<IconBookOpen />} aria-label="Help" /> <IconButton variant="tertiary" size="small" icon={<IconSettingsCog />} aria-label="Settings" /> </> } /> );}API reference
Section titled “API reference”AppHeader
Section titled “AppHeader”Displays a basic application header.
- Ref<HTMLDivElement>
-
The
reftype for this component.
AppHeaderProps
- string
title *
Section titled “ title * ” -
The title displayed in the header, usually the application name. Rendered as an
<h1>element. - string | AppHeaderTitleLinkProps
titleLink *
Section titled “ titleLink * ” -
The props of the link that is rendered around the header title.
- ReactNode
tools
Section titled “ tools ” -
The tools to render at the end of the header.
- ReactNode
UNSTABLE_navButton
Section titled “ UNSTABLE_navButton ” - ReactNode
UNSTABLE_postTitle
Section titled “ UNSTABLE_postTitle ” - ReactNode
UNSTABLE_search
Section titled “ UNSTABLE_search ” - string
-
The element's unique identifier. See MDN.
- boolean
data-cim-style-root
Section titled “ data-cim-style-root ” -
Use this attribute to "claim" the component tree for exclusive Cimpress UI usage.
- string
UNSAFE_className
Section titled “ UNSAFE_className ” -
Sets the CSS className for the element. Only use as a last resort. Use style props instead.
See styling guide.
- CSSProperties
UNSAFE_style
Section titled “ UNSAFE_style ” -
Sets the CSS style for the element. Only use as a last resort. Use style props instead.
See styling guide.
SimpleAuthTool
Section titled “SimpleAuthTool”A header tool for simple authentication.
SimpleAuthToolProps
- () => void
onLoginRequested *
Section titled “ onLoginRequested * ” -
A function called when the user requests to log in.
- () => void
onLogoutRequested *
Section titled “ onLogoutRequested * ” -
A function called when the user requests to log out.
- SimpleAuthProfile
profile
Section titled “ profile ” -
The profile data of the currently logged in user.
- string
accountName
Section titled “ accountName ” -
The name of the account associated with the user.