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

User Menu

<ahi-user-menu> | AhiUserMenu

The user menu is intended to be member of the top bar component and renders as the primary menu.

My account Settings Help & support Debug & Testing Tools EMR build PM build Session browser
<div style="background: var(--ahi-color-accent-secondary); padding: var(--ahi-space-2) var(--ahi-space-4); border-radius: var(--ahi-border-radius-medium); display: flex; justify-content: flex-end;">
<ahi-user-menu
  slot="secondary-nav"
  build="2023 Azalea Health - v4.0 Build # 28286"
  class="user-menu"
>
  <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>
</div>

<script type="module">
  const userMenu = document.querySelector(".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>

Importing

Script Bundler

To import this component using a script tag:

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

To import this component using a bundler:

import '@azaleahealth/azalea-kit-ui/dist/components/user-menu/user-menu.js';

Slots

Name Description
(default) The user menu’s content.

Learn more about using slots.

Properties

Name Description Type Default
build A string that uniquely identifies the application and its build/version string ''
user Object that represents information about the currently logged in user User {}
tenant Object that represents information about the current tenant/client Tenant {}
timestamp The current date/time in UTC. If not set, the current date and time will be used. When passing a string, it’s strongly recommended to use the ISO 8601 format to ensure timezones are handled correctly. To convert a date to this format in JavaScript, use date.toISOString(). Date | string new Date()
updateComplete A read-only promise that resolves when the component has finished updating.

Learn more about properties and attributes.

Dependencies

This component automatically imports the following dependencies.

  • <ahi-avatar>
  • <ahi-button>
  • <ahi-divider>
  • <ahi-dropdown>
  • <ahi-format-date>
  • <ahi-icon>
  • <ahi-menu>
  • <ahi-menu-item>
  • <ahi-popup>
  • <ahi-spinner>