Agents
Selectable agent list with enabled/disabled grouping, loading skeletons, empty state, selection, and badges.
Usage
Bind selectedId in the caller and update it from select. Use custom group titles when the list is shown outside an English-only surface.
Loading demo...
Best Practices
- Keep this component at the picker layer. Start conversations, fetch capabilities, and run agents in the surrounding feature module.
- Provide localized
enabledTitle,disabledTitle, andemptyTextwhen the surrounding page is localized. - Use stable ids from backend or registry data; avoid display names as ids because names may be localized or renamed.
- Keep
badgeTextshort: counts, status initials, or compact labels. Use thebadgeslot only when the badge needs custom visuals. - Use
loadingfor initial data fetches. For per-agent execution status, add status text or badges to each agent record instead of blocking the whole list.
API Reference
TxAgentsList Props
| Prop | Type | Default | Description |
|---|---|---|---|
agents | AgentItemProps[] | required | Agent records. Enabled items render before disabled items. |
selectedId | string | null | null | Marks the matching agent item as selected. |
loading | boolean | false | Shows four list-item skeleton rows instead of agent groups. |
enabledTitle | string | 'Enabled' | Section title for agents where disabled is not set. |
disabledTitle | string | 'Disabled' | Section title for agents where disabled=true. |
emptyText | string | 'No agents' | Empty-state text when agents is empty and the list is not loading. |
TxAgentsList Events
| Event | Payload | Description |
|---|---|---|
select | string | Re-emitted from enabled TxAgentItem rows with the selected id. |
TxAgentItem Props
| Prop | Type | Default | Description |
|---|---|---|---|
id | string | required | Stable id emitted through select. |
name | string | required | Primary label. |
description | string | '' | Optional secondary text. |
iconClass | string | 'i-carbon-bot' | Icon class rendered in the generated avatar area. |
selected | boolean | false | Applies active styling and aria-selected=true. |
disabled | boolean | false | Prevents click / Enter / Space selection and applies aria-disabled=true. |
badgeText | string | number | '' | Optional right-side badge. Empty string, null, and undefined hide the badge slot. |
Slots
TxAgentsList
TxAgentsList does not expose custom slots. Customize row-level badge visuals through TxAgentItem data/slot usage when composing items directly.
TxAgentItem
| Slot | Props | Description |
|---|---|---|
badge | - | Replaces the default right-side badge content when badgeText is present. |
TxAgentItem Events
| Event | Payload | Description |
|---|---|---|
select | string | Emitted only when an enabled item is activated by click, Enter, or Space. |
Overview
TxAgentsListcomputes enabled and disabled groups from the sameagentsarray; it does not mutate or sort inside each group.- Loading state wins over list and empty rendering;
agentscontent is ignored whileloading=true. - Each group body has
role="listbox"and anaria-labelequal to the group title. TxAgentItemis built onTxCardItemwithrole="option",avatarShape="rounded", andclickablealways on so disabled rows keep theiroptionrole in the listbox; selection on disabled rows is blocked byaria-disabledand the click guard, not by dropping the role.- Disabled items suppress click, Enter, and Space selection; enabled items emit the item
idfor all three activation paths.
Technologies
- Source:
packages/tuffex/packages/components/src/agents/src/TxAgentsList.vueconfirms loading skeletons, enabled/disabled grouping, group badges, empty state, andselectre-emit behavior. - Source:
packages/tuffex/packages/components/src/agents/src/TxAgentItem.vueconfirmsTxCardItemcomposition,role="option", disabled guards,aria-selected,aria-disabled, andbadgeslot rendering. - Type contracts:
packages/tuffex/packages/components/src/agents/src/types.tsdefinesAgentItemProps,AgentsListGroup, andAgentsListProps. - Verified coverage: Coverage:
packages/tuffex/packages/components/src/agents/__tests__/agents.test.tscovers group titles, empty text, enabled-only selection, keyboard activation, and disabled suppression.
查看源码
packages/tuffex/packages/components/src/agents/index.ts