# Quote

> 别人写的文字，在 Markdown 以外显示：前面一条 2px 的引用竖条，文字用正文颜色，和 Raft 在它周围写的值区分开。

Source: https://raft-design.botiverse.build/zh/components/quote. Translated from https://raft-design.botiverse.build/components/quote.md; where the two differ, the English page is right.

Quote 显示人或 Agent 写的文字，用在 Raft 在消息以外显示这些文字的地方：面板里任务的标题、Worker 留下的备注、请求里 Agent 给出的理由。引用竖条说明这是谁写的话，它就不会被读成旁边 Raft 自己的标签或值。

```tsx
import {
  DescriptionDetails,
  DescriptionItem,
  DescriptionList,
  DescriptionTerm,
} from "@botiverse/raft-ui";
import { Quote } from "@botiverse/raft-ui/wip";

/**
 * What an agent was given under a message: the panel's own terms, Raft's
 * values as plain text, and what someone else wrote behind the quote bar.
 */
export function QuotePreviewContent() {
  return (
    <DescriptionList direction="horizontal" className="w-full max-w-lg">
      <DescriptionItem>
        <DescriptionTerm>Task edit</DescriptionTerm>
        <DescriptionDetails>#eng:#7 · revision 3 · edited by @amy</DescriptionDetails>
      </DescriptionItem>
      <DescriptionItem>
        <DescriptionTerm>Current title</DescriptionTerm>
        <DescriptionDetails>
          <Quote>Move the nightly export to the new storage bucket</Quote>
        </DescriptionDetails>
      </DescriptionItem>
      <DescriptionItem>
        <DescriptionTerm>Worker note</DescriptionTerm>
        <DescriptionDetails>
          <Quote>
            {
              "Export moved; the old bucket stays read-only until Friday.\nCheck https://storage.example.com/exports/nightly-2026-11-27/manifest.json before deleting it."
            }
          </Quote>
        </DescriptionDetails>
      </DescriptionItem>
    </DescriptionList>
  );
}
```

## 何时使用
| 场景 | 用法 |
| --- | --- |
| 人或 Agent 写的纯文字，在面板、列表或对话框里和 Raft 自己的文字放在一起 | Quote |
| 有人在消息里输入的引用（Markdown 的 `>`） | `MarkdownBlockquote`（[Markdown](https://raft-design.botiverse.build/zh/components/markdown.md)），和消息里其他 Markdown 一样用 `foreground-muted` |
| 被另一条消息链接的消息：作者、位置、时间和前几行 | [MessageQuotedPreview](https://raft-design.botiverse.build/zh/components/message-quoted-preview.md) |
| 回复时引用一条消息或其中一段，在输入框或发出的消息里 | 引用标签片（[对话](https://raft-design.botiverse.build/zh/patterns/conversation.md#quotes-in-the-composer-and-the-message)） |
| Raft 自己的值：引用编号、用户名、ID、状态、时间、命令 | 纯文字，不加引用 |
| 有人写的、作为行的名字或页面标题的文字（频道名、行里的任务标题） | 组件自己的名字或标题部件：在那里它是这一项的名字，不是对它的引用 |

## 结构
- `Quote`：一个 `blockquote`，前面是引用竖条，里面是被引用的文字。必需。

这条竖条和 Raft 里每处引用画的是同一条：左侧 2px 的 `line-seam`，文字在它后面 10px（[形状](https://raft-design.botiverse.build/zh/foundations/shape.md#stroke-widths)）。`MarkdownBlockquote`、`MessageQuotedPreview` 和操作卡片的说明都从同一个 recipe 取这条竖条，所以每处引用的竖条都一样。Quote 没有填充，也没有圆角。

说明这是谁的话的标题或术语放在引用外面，用页面自己的口吻。

```tsx
import { Text } from "@botiverse/raft-ui";
import { Quote } from "@botiverse/raft-ui/wip";

/**
 * An agent's own words in a request: the caption, in the page's voice, says
 * whose words they are; the quote holds only what the agent wrote.
 */
export function QuoteOnAPageContent() {
  return (
    <figure className="m-0 flex w-full max-w-md flex-col gap-1.5 text-sm/5">
      <Text.Sans size="small" variant="note" render={<figcaption />}>
        Atlas's reason
      </Text.Sans>
      <Quote>
        I need write access to deploy the docs site. Read access already covers the rest of the
        repository.
      </Quote>
    </figure>
  );
}
```

## 行为
- 文字用正文颜色 `foreground`，不倾斜：它是人要读的内容，属于基础层级（[字体排印](https://raft-design.botiverse.build/zh/foundations/typography.md#color-tiers)），不是辅助说明。被引用的消息是灰色，因为它是为它下面那条消息服务的；而这里的文字本身就是要显示的东西。
- 它沿用周围文字的字号和行高，所以放在描述列表的值里时，它就是值的 `text-callout`。字号设在容器上，不要设在引用上。
- 它保留作者写的换行，必要时在长单词或地址中间断行，粘贴进来的路径或链接不会把容器撑宽。
- 它占满自己的一行，在会换行的 flex 行里（比如描述列表的值）也是，并随行收缩（`min-w-0`）。

## 内容
- 只放人或 Agent 写的东西，照他们写的样子：标题、描述、备注、理由、文件名、Raft 无法校验的值。不要增删，不要翻译。
- 不要把 Raft 自己的话放进去：面板的术语、引用编号、用户名、ID、状态、时间或 Raft 打印的命令都放在它旁边，作为纯文字。放在引用竖条里的标签会被读成某人写的话。
- 在引用外面说明这是谁的话：[DescriptionList](https://raft-design.botiverse.build/zh/components/description-list.md) 的术语、图注或标题。
- 它只是文字。里面不放链接或按钮：别人的话不能成为 Raft 的控件。

## 无障碍
- 它是原生的 `blockquote`，读屏软件会把它读作引用。
- 被引用的文字来自一个有地址的页面时，把地址传给 `cite`。浏览器不会显示它，所以也要在人能看到的地方写明来源。
- 要把看得到的说明和引用关联起来，把两者放进一个 `figure`，说明放在它的 `figcaption` 里，如上例。在描述列表里，术语已经给它命名。

## 规则
- 别人的文字用 Quote，Raft 自己的值用纯文字，两者永远不会看起来一样。
- 保持正文颜色。不要把 Quote 变灰：灰色留给辅助说明和消息下方被引用的消息。
- 只在 Markdown 以外用 Quote。渲染出来的 Markdown 里，引用是 `MarkdownBlockquote`。

## API

### Quote

Text someone else wrote, shown outside Markdown: a `<blockquote>` behind the 2px quote bar, in the body text colour. It takes the size of the text around it, keeps the line breaks the writer wrote and takes its whole line.

Also takes the attributes of its element.
