Axon 911 Frontend DocsAxon 911 Frontend Docs
Axon 911 Frontend Docs
    Loading navigation…
U
User
Switch to light mode
  1. Blocks
  2. App Header
  3. API and Development

App Header

API and Development

View SourceOpens in a new tabSubmit IssueOpens in a new tab
Import AppHeader, AppHeaderRole from @prepared911/ui/blocks/app-header. See props.ts for the props and schema.ts for the declaration (inputs and variants). role is the discriminant of a union: each role takes only its own props. AppHeader takes no children, className, id, ref or style. AppHeaderRole: Calltaker, Dispatcher, Supervisor.
Every role
PropTypeDefault
roleAppHeaderRolerequired
labelLocalizedMessagerequired
landmarkNavbarLandmarkBanner
stickybooleanfalse
stickyInsetNavbarInset0
homeHrefstringrequired
homeLabelLocalizedMessagerequired
navigationLabelLocalizedMessagerequired
overflowLabelLocalizedMessagerequired
currentPathstringrequired
navigate(path: string) => voidrequired
matchPathNavbarTabsProps["matchPath"]pathname equality
islandLabelLocalizedMessagerequired
notificationsLabelLocalizedMessagerequired
onNotificationsPress() => voidnone
toolsLabelLocalizedMessagerequired
fullscreenLabelLocalizedMessagerequired
onFullscreenPress() => voidnone
closeLabelLocalizedMessagerequired
onClosePress() => voidnone
AppHeaderRoute: href (string), label (LocalizedMessage), optional extraRouteMatchers.
Calltaker and Dispatcher
PropTypeDefault
routesAppHeaderOperatorRoutes (live, archived)required
roleLabelLocalizedMessagerequired
queueLabelLocalizedMessagerequired
raiseHandLabelLocalizedMessagerequired
raisedHandbooleanuncontrolled
defaultRaisedHandbooleanfalse
onRaisedHandChange(raised: boolean, details: ChangeDetails) => voidnone
trainingLabelLocalizedMessagerequired
onTrainingPress() => voidnone
preferencesLabelLocalizedMessagerequired
onPreferencesPress() => voidnone
Calltaker only
PropTypeDefault
statusControlIslandStatus (Busy, Ready, Ringing)uncontrolled
defaultStatusControlIslandStatusBusy
onStatusChange(status: ControlIslandChoosableStatus, details: ChangeDetails) => voidnone
busyLabelLocalizedMessagerequired
readyLabelLocalizedMessagerequired
ringingLabelLocalizedMessagerequired
statusMenuLabelLocalizedMessagerequired
ringingAnnouncementLocalizedMessagerequired
The Dispatcher role types status, defaultStatus and onStatusChange as never.
Supervisor
PropTypeDefault
routesAppHeaderSupervisorRoutes (live, archived, learning, settings)required
roleLabelsAppHeaderRoleLabels (one LocalizedMessage per role)required
activeRoleAppHeaderRoleuncontrolled
defaultActiveRoleAppHeaderRoleSupervisor
onActiveRoleChange(role: AppHeaderRole, details: ChangeDetails) => voidnone
Props
NameTypeDefaultDescription
accountLabelLocalizedMessage—Accessible name of the account cog (settings), which opens the account menu.
accountNameUserMenuName—The person's name in the account menu header.
appearanceLabelsUserMenuAppearanceLabels—Names of the theme choices. The account menu shows the theme row from these.
busyLabelLocalizedMessage—Label of Busy, on the pill and on its menu row.
closeLabelLocalizedMessage—Name of the close control (x).
currentPathstring—Current pathname, which decides the current tab.
fullscreenLabelLocalizedMessage—Name of the full screen control.
homeHrefstring—Where the Axon mark at the start goes, usually the home route.
homeLabelLocalizedMessage—Accessible name of the Axon mark's link, such as "Home".
islandLabelLocalizedMessage—Accessible name of the ControlIsland at the start, such as "Role and availability".
labelLocalizedMessage—Accessible name of the bar. It names the banner, or the navigation landmark when landmark says so.
navigate(path: string) => void—Called with a route's href on an unmodified primary click on a tab, and on a press of its row in the overflow menu, so a client router can handle both. @param path - The route's href
navigationLabelLocalizedMessage—Accessible name of the navigation landmark that holds the route tabs.
notificationsLabelLocalizedMessage—Name of the notifications control (bell-ring).
onSignOut() => void | Promise<void>—Called when a person presses Log out. When it returns a promise the row stays busy until the promise settles, then the menu closes. The block does not log the person out.
overflowLabelLocalizedMessage—Visible label of the control that opens the menu of routes that do not fit.
preferencesLabelLocalizedMessage—Name of the preferences control (settings-2).
queueLabelLocalizedMessage—The queue (Calltaker) or channel (Dispatcher) being worked, such as "All queues". Static text.
raiseHandLabelLocalizedMessage—Name of the raise hand control. It does not change with the pressed state.
readyLabelLocalizedMessage—Label of Ready, on the pill and on its menu row.
reduceMotionLabelLocalizedMessage—Label of the Reduce motion switch in the account menu. The row lets a person turn animation off on a slow device.
ringingAnnouncementLocalizedMessage—Announced politely once when the status becomes Ringing, such as "Incoming call".
ringingLabelLocalizedMessage—Label of Ringing, on the pill.
roleAppHeaderRole—The Calltaker header. The Dispatcher header. The Supervisor header.
roleLabelLocalizedMessage—Name of the role on the island's badge, such as "Calltaker". The badge shows only a glyph.
roleLabelsReadonly<Record<AppHeaderRole, LocalizedMessage>>—Names of the switcher's roles. Each is its segment's accessible name and shows while the segment is selected.
routesAppHeaderOperatorRoutes | AppHeaderSupervisorRoutes—The route tabs: Live and Archived. The route tabs: Live, Archived, Learning and Settings.
signingOutLabelLocalizedMessage—Label of the log out row while onSignOut is pending.
signOutLabelLocalizedMessage—Label of the log out row. It is the last row of the account menu.
statusMenuLabelLocalizedMessage—Name of the availability menu, such as "Availability". It names the radio group and describes the pill.
toolsLabelLocalizedMessage—Accessible name of the cluster after the separator: preferences (where the role has it), full screen and close.
trainingLabelLocalizedMessage—Name of the training control (graduation-cap).
accountEmailDisplayValue—The person's email in the account menu header. Truncated there; the full text is the title.
activeRoleAppHeaderRole—The role selected in the switcher when controlled. The header stays the Supervisor header whatever it holds.
appearanceAppearanceMode—Controlled appearance preference. Pair with onAppearanceChange. The host applies it.
defaultActiveRoleAppHeaderRoleAppHeaderRole.SupervisorThe role selected in the switcher on first render when uncontrolled.
defaultAppearanceAppearanceModesystemInitial appearance preference when uncontrolled.
defaultRaisedHandbooleanfalseInitial raised state when uncontrolled.
defaultReduceMotionbooleanfalseInitial reduce motion preference when uncontrolled.
defaultStatusControlIslandStatusControlIslandStatus.BusyInitial availability when uncontrolled. A dispatcher has no availability; use {@link AppHeaderRole.Calltaker}.
landmarkNavbarLandmarkNavbarLandmark.BannerLandmark of the bar. A shell that has a banner of its own passes {@link NavbarLandmark.Navigation} so a page never has two banners.
matchPathMatchPathFn—Route matcher, for example react-router matchPath. Defaults to pathname equality.
onActiveRoleChange((role: AppHeaderRole, details: ChangeDetails<ChangeReason>) => void)—Called when a role segment is pressed; pressing the selected role does not call it. Cancel the details to keep the previous role. @param role - The pressed role @param details - Change metadata
onAppearanceChangeAppearanceChangeHandler—Called when a person picks a theme. The block only reports the choice; the host applies it, for example by setting data-theme on the document. The menu stays open. May be canceled.
onClosePress(() => void)—Called when the close control is pressed.
onFullscreenPress(() => void)—Called when the full screen control is pressed.
onNotificationsPress(() => void)—Called when the notifications control is pressed.
onPreferencesPress(() => void)—Called when the preferences control is pressed.
onRaisedHandChange((raised: boolean, details: ChangeDetails<ChangeReason>) => void)—Called with the next state when the raise hand control is pressed. Cancel the details to keep the previous state. @param raised - Next raised state @param details - Change metadata
onReduceMotionChangeReduceMotionChangeHandler—Called when a person flips the Reduce motion switch. The block only reports the choice; the host applies it, for example by setting data-motion="reduced" on the document. May be canceled.
onStatusChange((status: ControlIslandChoosableStatus, details: ChangeDetails<ChangeReason>) => void)—Called with the chosen availability when a row of the status menu is pressed; never with Ringing. Cancel the details to keep the previous availability. A dispatcher has no availability; use {@link AppHeaderRole.Calltaker}. @param status - The chosen availability @param details - Change metadata
onTrainingPress(() => void)—Called when the training control is pressed.
raisedHandboolean—Whether the hand is raised when controlled. Pair with onRaisedHandChange.
reduceMotionboolean—Controlled reduce motion preference. Pair with onReduceMotionChange. The host applies it.
statusControlIslandStatus—Availability when controlled. The host sets {@link ControlIslandStatus.Ringing} while a call is incoming and sets the person's choice back when it ends. A dispatcher has no availability; use {@link AppHeaderRole.Calltaker}.
stickybooleanfalseKeeps the bar at the block-start edge of its scrollport while the page scrolls.
stickyInsetNavbarInset0Distance between the stuck bar and the block-start edge, as a --space-* step. Only read when sticky.
Storybook
Interactive examples and edge cases for this component are in Storybook.
DefaultOpens in a new tab
Previous
App Header / Usage
Next
App Header / Accessibility
On this page
Every role
Calltaker and Dispatcher
Calltaker only
Supervisor
Props
Storybook