KNOW IDEA UIv0.18.0GitHub

Conversation

会話の流れ。自分の話は右、相手の返事は左に、時の順に並べる。新しい話は下に足す。続けて同じ人が話した時は、名前と頭像を省いて間を詰める。書く欄は持たないので、下に TextField や Textarea を置く。

tsx
import { Conversation } from "knowidea-ui";

カテゴリ: Data display。同じカテゴリ: Avatar、Badge、Chip、Status、Stat、Table、List、Timeline、Tooltip、Popover、CodeBlock、Kbd、Quote、Display、Jacket、CodeEditor、DiffView

Demos

デモの数値はすべてサンプルであり、実際の値ではない。

Basic

相手の話には名前と頭像が付く。時刻は <time> で出す。

  1. 自分

    色の検査の結果を教えて。

  2. 作

    作る役

    本文と背景の差は、どのページも 4.5:1 以上でした。

  3. 線の差が足りない所が 2 か所あり、直しています。

  4. 自分

    直ったら知らせて。

Show code
tsx
import { Conversation, type ConversationMessage } from "knowidea-ui";​const messages: ConversationMessage[] = [  { id: "1", from: "self", author: "自分", time: "2026-10-13T09:20", timeLabel: "09:20", body: "色の検査の結果を教えて。" },  { id: "2", from: "other", author: "作る役", time: "2026-10-13T09:21", timeLabel: "09:21", body: "本文と背景の差は、どのページも 4.5:1 以上でした。" },  { id: "3", from: "other", author: "作る役", time: "2026-10-13T09:21", timeLabel: "09:21", body: "線の差が足りない所が 2 か所あり、直しています。" },  { id: "4", from: "self", author: "自分", time: "2026-10-13T09:24", timeLabel: "09:24", body: "直ったら知らせて。" },];​function Basic() {  return <div style={{ width: "100%" }}><Conversation messages={messages} /></div>;}

Pending reply

相手が返事を書いている間は、pending の 1 行を出す。点を動かす飾りは使わない。

  1. 自分

    色の検査の結果を教えて。

  2. 作

    作る役

    本文と背景の差は、どのページも 4.5:1 以上でした。

  3. 線の差が足りない所が 2 か所あり、直しています。

  4. 自分

    直ったら知らせて。

作る役が返事を書いている

Show code
tsx
import { Conversation, type ConversationMessage } from "knowidea-ui";​const messages: ConversationMessage[] = [  { id: "1", from: "self", author: "自分", time: "2026-10-13T09:20", timeLabel: "09:20", body: "色の検査の結果を教えて。" },  { id: "2", from: "other", author: "作る役", time: "2026-10-13T09:21", timeLabel: "09:21", body: "本文と背景の差は、どのページも 4.5:1 以上でした。" },  { id: "3", from: "other", author: "作る役", time: "2026-10-13T09:21", timeLabel: "09:21", body: "線の差が足りない所が 2 か所あり、直しています。" },  { id: "4", from: "self", author: "自分", time: "2026-10-13T09:24", timeLabel: "09:24", body: "直ったら知らせて。" },];​function Pending() {  return <div style={{ width: "100%" }}><Conversation messages={messages} pending="作る役が返事を書いている" /></div>;}

Sending and failed

送っている途中の話は薄く、送れなかった話は枠の色と文字で示す。

  1. 自分

    予定を 1 日延ばして。

    送っている

  2. 理由も書いておいて。

    送れなかった

Show code
tsx
import { Conversation } from "knowidea-ui";​function Status() {  return (    <div style={{ width: "100%" }}>      <Conversation        messages={[          { id: "1", from: "self", author: "自分", timeLabel: "09:30", time: "2026-10-13T09:30", body: "予定を 1 日延ばして。", status: "sending" },          { id: "2", from: "self", author: "自分", timeLabel: "09:31", time: "2026-10-13T09:31", body: "理由も書いておいて。", status: "failed" },        ]}      />    </div>  );}

States

すべてのコンポーネントが、Empty、Loading、Error、Disabled、Focus の 5 つの状態を備える。Hover と Active は、確認用に固定して表示している。そのコンポーネントにあてはまらない状態は「対象外」とし、理由を添える。

StateAppearance
Empty

まだ話が無い

下の欄から話しかけると、ここに並ぶ。

話が 0 件の時は empty を出す

Loading

Skeleton で吹き出しの形をまねる。相手が書いている間は pending の 1 行を出し、動かさない

Error
  1. 自分

    理由も書いておいて。

    送れなかった

送れなかった話は枠の色と「送れなかった」の文字で示す。送り直す操作は使う側が置く

Disabled対象外。無効状態を持たない。押せる所を持たない
Focus対象外。押せる所を持たない。吹き出しの中のリンクは、ふつうのリンクとして focus を受ける

API

NameTypeDefaultDescription
messagesConversationMessage[]-{ id, from: "self" | "other", author, avatar?, time?, timeLabel?, body, status? }
pendingstring-相手が返事を書いている時の 1 行
emptyReactNode-話が 1 つも無い時に出す物
labelstring"会話"読み上げの名前

CSS

Classes and data attributes

NameDescription
.ki-convo本体。role="log"
.ki-convo__msg話。data-from: self | other、data-continued、data-status: sending | failed
.ki-convo__bubble、__author、__meta、__status、__pending内部の要素

CSS variables

コンポーネントが参照するのは、役割を表す名前の変数だけで、素の値は参照しない。オーバーライドの方法は Overriding を参照。

VariableUsage
--color-surface-2相手の吹き出しの面
--color-primary自分の吹き出しの面(12% を混ぜる)
--color-error送れなかった話の枠

Accessibility

KNOW IDEA UIv0.18.0

GitHub

ページと見出しを探す。/ か Ctrl K でどのページからも開く。

Code