Changelog Azalea Kit UI 101 Usage Customizing Utilities Form controls Laravel Vue FHIR Types Accessibility Icons Actions Button Button group Layout and structure Card Card section Care summary Care timeline Divider Empty state Footer Header Layout Stack Table Selection and input Calendar Checkbox Checkbox group Color picker Combobox Combobox option Input Input mask Memorable date Number input Option Phone input Radio Radio button Radio group Range Select SSN input Tag Textarea Toggle ZIP code input Images and icons Avatar Icon Icon button Logo Feedback indicators Badge Banner Progress bar Skeleton Skeleton body text Skeleton display text Skeleton thumbnail Spinner Typography Text Navigation Breadcrumb Breadcrumb item Dropdown Menu Menu item Menu label Navigation Nav group Nav item Nav toggle Pagination Tab Tab group Tab panel Top bar Tree Tree item User menu Overlays Dialog Popover Tooltip Utilities Collapsible FHIR address FHIR human name FHIR quantity FHIR questionnaire Format bytes Format date Format number Relative time Resize observer Split panel Tooltip Border Color Shadow Spacing Transition Typography Z-index Contributing Visual Tests Light Dark System

Top Bar

<ahi-top-bar> | AhiTopBar

The top bar is a header component that is always visible at the top of the interface. Top bar allows functionality such as search and contextual menus to be placed at the top of the interface.

Use to provide structure for the top of an application.

Application Title

99+ My account Settings Help & support Debug & Testing Tools EMR build PM build Session browser
<ahi-top-bar class="top-bar">
  <p class="ahi-text-heading ahi-text-medium">Application Title</p>

  <ahi-tooltip slot="end" content="Notifications">
    <ahi-icon-button name="bell" label="Notifications">
      <ahi-badge status="info">99+</ahi-badge>
    </ahi-icon-button>
  </ahi-tooltip>

  <ahi-tooltip slot="end" content="Applications">
    <ahi-icon-button name="grid-dots" label="Applications"></ahi-icon-button>
  </ahi-tooltip>

  <ahi-user-menu slot="end" build="2023 Azalea Health - v4.0 Build # 28286">
    <ahi-menu-item value="my-account">
      <ahi-icon slot="prefix" name="user"></ahi-icon>
      My account
    </ahi-menu-item>
    <ahi-menu-item value="settings">
      <ahi-icon slot="prefix" name="settings"></ahi-icon>
      Settings
    </ahi-menu-item>
    <ahi-menu-item value="help">
      <ahi-icon slot="prefix" name="help"></ahi-icon>
      Help & support
    </ahi-menu-item>
    <ahi-menu-label>Debug & Testing Tools</ahi-menu-label>
    <ahi-menu-item value="emr">
      <ahi-icon slot="prefix" name="first-aid-kit"></ahi-icon>
      EMR build
    </ahi-menu-item>
    <ahi-menu-item value="pm">
      <ahi-icon slot="prefix" name="report-money"></ahi-icon>
      PM build
    </ahi-menu-item>
    <ahi-menu-item value="session-browser">
      <ahi-icon slot="prefix" name="browser"></ahi-icon>
      Session browser
    </ahi-menu-item>
  </ahi-user-menu>
</ahi-top-bar>

<script type="module">
  const topBar = document.querySelector('.top-bar');
  const userMenu = topBar.querySelector('ahi-user-menu');

  userMenu.user = {
    /** The name displayed for the user. This is usually the combination of the user's first name, middle initial and last name. */
    name: 'John Doe',

    /** The user's email address */
    email: 'john.doe@azaleahealth.com',

    /** The user's first and last initial */
    initials: 'JD',

    /** The user's job title */
    title: 'Software Developer'

    /** URL source to the user's profile image/avatar */
    // image: "..."
  };

  userMenu.tenant = {
    /** The tenant/client's name i.e. "TESTING CLIENT EHR" */
    name: 'TESTING CLIENT EHR',

    /** The tenant/client's IANA time zone ID i.e. "America/New_York", "America/Chicago" etc. */
    timeZone: 'America/Chicago'
  };

  userMenu.addEventListener('ahi-select', event => {
    const value = event.detail.item.value;

    switch (value) {
      case 'my-account':
        console.log('Navigate to My account...');
        // location.href = '...';
        break;
      // ...
      case 'sign-out':
        console.log('Sign out...');
        // location.href = '...';
        break;
    }
  });

  const tick = () => {
    userMenu.timestamp = new Date().toISOString();
  };

  const interval = setInterval(tick, 1000);
</script>

Best practices

The top bar component should:

  • Include a user menu component to indicate the logged-in user and provide them with global actions
  • Put the application logo in <ahi-navigation>’s header slot, not here — that is where every template places it, and it keeps the mark with the sidebar it belongs to
  • Keep slotted text to a type role. The bar sets the text color so it stays legible on the accent background, but the size is yours to choose

Importing

Script Bundler

To import this component using a script tag:

<script type="module" src="/path/to/azalea-kit-ui/dist/components/top-bar/top-bar.js"></script>

To import this component using a bundler:

import '@azaleahealth/azalea-kit-ui/dist/components/top-bar/top-bar.js';

Slots

Name Description
(default) Used for the main content of the top bar. We recommend placing your application’s global search functionality into this slot.
end Optional slot for menus, buttons, toggles, etc.

Learn more about using slots.