qat

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

KassaLM

The sidebar is open.

Example.qx41 lines, 1 reactive nameOpen in the playground
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 state

Add it

shell1 line
npx qatjs add shell

TopBar

As a custom element: <ui-top-bar>.

TopBar: props
PropTypeAttribute
brandQatNodeproperty only
brandHrefQatHrefyes
navNavItem[]property only
labelstringyes

As a custom element: <ui-sidebar>.

Sidebar: props
PropTypeAttribute
labelstringyes
groups{ label?: string; items: NavItem[] }[]property only
collapsedbooleanyes
collapsiblebooleanyes
footerQatNodeproperty only
Sidebar: events
EventDetail
on:update:collapsedCustomEvent<boolean>