Skip to content
EspañolEnglish
All components (283)

Task queue

AI · TaskQueue

What it is and when to use it

What is queued or under way: messages waiting their turn, pending tasks. Each group folds and says how many it has; each item, its state.

When to use it

  • Showing what an agent has ahead: user messages that arrived while it works, tasks it has left.
  • sections are the groups: { key, title, items }, and each item { key, label, status?, detail? }. A group without items is not drawn.
  • With onRemove, each item has a button to remove it, which names what it removes.

When not to

  • The steps of a plan in order: Plan.
  • A record of what happened: ActivityLog.
  • A list that is sorted by dragging: SortableList.

Keyboard: Tab goes through the group titles and the remove buttons; Enter or Space folds a group or removes an item.

Accessibility: it is a group with a name (label); each item says its state with an icon and hidden text, and each remove button says what it removes ("Remove Review the contract").

Fine-tuning: amset-taskqueue and the amset-taskqueue__* classes.

What it looks like

  • PendingAnd add the French ones too
  • PendingSend the summary to Marta
  • In progressReview the contract
  • PendingPrepare the invoiceToday

<TaskQueue
  label="Agent queue"
  sections={[
    { key: "messages", title: "Waiting messages", items: [{ key: "m1", label: "Send the summary to Marta" }] },
    { key: "tasks", title: "Tasks", items: [{ key: "t1", label: "Review the contract", status: "active" }] },
  ]}
/>

Props

Import it with import { TaskQueue } from '@amset/ui'. Required props are marked.

PropTypeWhat it does
labelrequiredstringWhat this queue is: "Waiting messages". Required: it is the name of the region.
sectionsrequiredreadonly QueueSection[]The groups of the queue: `{ key, title, items }`. Each group folds.
classNamestringMerged with the library classes; it does not replace them.
onRemove(sectionKey: string, itemKey: string) => voidIf given, each item has a button to remove it from the queue.

It also accepts the attributes of the element it renders: className, style, data-*, aria-* and its events.

In the test bench

Every state and variant, to try one at a time, on its page at storybook.amsetui.com: