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 ₼
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 stateAdd it
npx qatjs add listList
As a custom element: <ui-list>.
| Prop | Type | Attribute |
|---|---|---|
label | string | yes |
items | ListItem[] | property only |
reorderable | boolean | yes |
actions | (item: ListItem) => QatNode | property only |
grabLabel | (item: ListItem) => string | property only |
| Event | Detail |
|---|---|
on:update:items | CustomEvent<ListItem[]> |
on:reorder | CustomEvent<[number, number]> |
DescriptionList
As a custom element: <ui-description-list>.
| Prop | Type | Attribute |
|---|---|---|
items | { term: QatNode; detail: QatNode; mono?: boolean }[] | property only |
Keys
| Key | Does |
|---|---|
| Space, Enter | pick up, drop (the grip) |
| ↑ ↓ | move the row held |
| Esc | put it back |