# Candidate List

> 供文本输入保持焦点时使用的轻量候选列表，选项与高亮由宿主控制。

网页来源：/components/candidate-list

版本：@quirekit/ui 0.3.1；源码修订：d79a6b48d00e+worktree。此文档对应当前源码构建，接入方式以开始使用为准。

接入前置：[开始使用](/raw/components/getting-started.md)（Vue、样式、主题与图标 Provider）。

Candidate List 只负责可读的 `listbox` / `option` 列表、禁用状态和点击选择，不接管键盘焦点。文本输入或编辑器继续持有选区，负责方向键、Enter、Escape、高亮 `activeKey`、候选过滤及关闭时机。候选项使用稳定 `key`，可附一行简短 `description`；它不是会自行管理选择值的 [Listbox](/raw/components/listbox.md)，也不是执行按钮命令的 Menu。

[Chat Composer 的富输入示例](/raw/components/chat-composer.md)将它用于 `@` 引用和 `/` 指令。输入旁的候选解析器由宿主提供，可处理远端查询和取消；列表本身不发请求或解释 token。

## API

### QuireCandidateList

#### Props

| 名称 | 必填 | 默认值 | 说明 |
| --- | --- | --- | --- |
| id | 是 | — | Stable DOM id used by aria-controls. |
| label | 是 | — | Accessible name for the suggestion set. |
| items | 是 | — | Visible candidates in feature order. |
| activeKey | 否 | — | Highlighted candidate identity controlled by the editor. |

**id**

```ts
string
```

**label**

```ts
string
```

**items**

```ts
readonly QuireKitCandidateListItem[]
```

```ts
readonly ({
  /** Stable feature identity. */
  key: string;
  /** Localized primary label. */
  label: string;
  /** Optional secondary explanation. */
  description?: undefined | string;
  /** Unavailable options remain readable but cannot be activated. */
  disabled?: boolean | undefined;
})[]
```

**activeKey**

```ts
string | undefined
```

```ts
undefined | string
```

#### Events

| 名称 | 必填 | 默认值 | 说明 |
| --- | --- | --- | --- |
| select | 否 | — |  |

**select**

```ts
[key: string]
```

#### Slots

无。

#### 公开实例成员

无。

#### 相关类型

```ts
type QuireKitCandidateListItem = {
  /** Stable feature identity. */
  key: string;
  /** Localized primary label. */
  label: string;
  /** Optional secondary explanation. */
  description?: undefined | string;
  /** Unavailable options remain readable but cannot be activated. */
  disabled?: boolean | undefined;
};
```
