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
<ahi-top-bar class="top-bar">
<p class="ahi-text-heading ahi-text-medium">Application Title</p>
<ahi-tooltip slot="end" content="99+ unread notifications">
<ahi-icon-button name="bell" label="99+ unread 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>’sheaderslot, 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
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.