Top bar and sidebar
TopBar, Sidebar. They are copied into your app’s ui/ by qatjs add shell: the code is yours to edit.
Example
The sidebar is open.
import { Avatar } from './ui/avatar/avatar.qx'
import { Sidebar, TopBar } from './ui/shell/shell.qx'
export default function Example() {
let narrow = state(false)
return (
<div class="example-frame">
<TopBar
brand="Kassa"
brandHref="#kassa"
label="Sections"
nav={[
{ label: 'Orders', href: '#orders', current: true },
{ label: 'Products', href: '#products' },
]}
>
<Avatar name="Leyla Məmmədova" />
</TopBar>
<div class="example-shell">
<Sidebar
label="Areas"
collapsible
bind:collapsed={narrow}
groups={[
{
items: [
{ label: 'Dashboard', href: '#dashboard' },
{ label: 'Orders', href: '#orders', count: 12, current: true },
],
},
{
label: 'Settings',
items: [{ label: 'Team', href: '#team', items: [{ label: 'Roles', href: '#roles' }] }],
},
]}
/>
<p>The sidebar is {narrow ? 'collapsed' : 'open'}.</p>
</div>
</div>
)
}narrow stateAdd it
npx qatjs add shellTopBar
As a custom element: <ui-top-bar>.
| Prop | Type | Attribute |
|---|---|---|
brand | QatNode | property only |
brandHref | QatHref | yes |
nav | NavItem[] | property only |
label | string | yes |
Sidebar
As a custom element: <ui-sidebar>.
| Prop | Type | Attribute |
|---|---|---|
label | string | yes |
groups | { label?: string; items: NavItem[] }[] | property only |
collapsed | boolean | yes |
collapsible | boolean | yes |
footer | QatNode | property only |
| Event | Detail |
|---|---|
on:update:collapsed | CustomEvent<boolean> |