qat

List

List, DescriptionList. They are copied into your app’s ui/ by qatjs add list: the code is yours to edit.

Example

  • Confirm the orderSends an SMS to the customer
  • PackTwo boxes
  • Hand to courierStarts tracking

Order: confirm, pack, hand

Order
10482
Courier
Azərpoçt
Total
84.00 ₼
Example.qx31 lines, 1 reactive nameOpen in the playground
import Button from './ui/button/button.qx'
import { DescriptionList, List } from './ui/list/list.qx'

export default function Example() {
  let steps = state([
    { id: 'confirm', title: 'Confirm the order', description: 'Sends an SMS to the customer' },
    { id: 'pack', title: 'Pack', description: 'Two boxes' },
    { id: 'hand', title: 'Hand to courier', description: 'Starts tracking' },
  ])
  return (
    <List
      label="Delivery steps"
      items={steps}
      reorderable
      bind:items={steps}
      actions={() => (
        <Button size="sm" variant="tertiary">
          Edit
        </Button>
      )}
    />
    <p>Order: {steps.map((x) => x.id).join(', ')}</p>
    <DescriptionList
      items={[
        { term: 'Order', detail: '10482', mono: true },
        { term: 'Courier', detail: 'Azərpoçt' },
        { term: 'Total', detail: '84.00 ₼', mono: true },
      ]}
    />
  )
}
steps state

Add it

shell1 line
npx qatjs add list

List

As a custom element: <ui-list>.

List: props
PropTypeAttribute
labelstringyes
itemsListItem[]property only
reorderablebooleanyes
actions(item: ListItem) => QatNodeproperty only
grabLabel(item: ListItem) => stringproperty only
List: events
EventDetail
on:update:itemsCustomEvent<ListItem[]>
on:reorderCustomEvent<[number, number]>

DescriptionList

As a custom element: <ui-description-list>.

DescriptionList: props
PropTypeAttribute
items{ term: QatNode; detail: QatNode; mono?: boolean }[]property only

Keys

KeyDoes
Space, Enterpick up, drop (the grip)
↑ ↓move the row held
Escput it back