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