# App header API

> Explore the API of Cimpress UI's app header component.

Source: https://ui.cimpress.io/components/app-header/api/

## Import

```tsx
import { AppHeader, SimpleAuthTool } from '@cimpress-ui/react';
```

## Accessibility notes

`AppHeader` is designed to be a [banner landmark](https://www.w3.org/WAI/ARIA/apg/patterns/landmarks/examples/banner.html). Make sure that app header is a direct descendant of your application's `<body>` element.

## 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.

```tsx
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

### AppHeader

Displays a basic application header.

See [app header usage guidelines](https://ui.cimpress.io/components/app-header/).

- `ref`: `Ref<HTMLDivElement>`

  The `ref` type for this component.

**Props: `AppHeaderProps`**

- `title` (required): `string`

  The title displayed in the header, usually the application name.

- `titleLink` (required): `string | AppHeaderTitleLinkProps`

  The props of the link that is rendered around the header title.

- `tools`: `ReactNode`

  The tools to render at the end of the header.

- `UNSTABLE_navButton`: `ReactNode`

- `UNSTABLE_postTitle`: `ReactNode`

- `UNSTABLE_search`: `ReactNode`

- `id`: `string`

  The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id).

- `data-cim-style-root`: `boolean`

  Use this attribute to "claim" the component tree for exclusive Cimpress UI usage.

- `UNSAFE_className`: `string`

  Sets the CSS className for the element. Only use as a **last resort**. Use style props instead.

  See [styling guide](https://ui.cimpress.io/dev-guides/styling/).

- `UNSAFE_style`: `CSSProperties`

  Sets the CSS style for the element. Only use as a **last resort**. Use style props instead.

  See [styling guide](https://ui.cimpress.io/dev-guides/styling/).

### SimpleAuthTool

A header tool for simple authentication.

**Props: `SimpleAuthToolProps`**

- `onLoginRequested` (required): `() => void`

  A function called when the user requests to log in.

- `onLogoutRequested` (required): `() => void`

  A function called when the user requests to log out.

- `profile`: `SimpleAuthProfile`

  The profile data of the currently logged in user.

- `accountName`: `string`

  The name of the account associated with the user.
