Skip to content

components/chat-bubble

ChatBubbleSide = "agent" | "user"

Which side of the conversation a bubble sits on.


ChatBubbleState = "settled" | "pending" | "error"

pending is still being written; error is a turn that did not finish.


ChatBubbleProps = object & Omit<HTMLAttributes<HTMLDivElement>>, "children">>

Props accepted by ChatBubble.

side: ChatBubbleSide

An agent speaks from the left with its mark; the person from the right.

optional avatar?: ReactNode

A mark for an agent, drawn beside its bubble.

optional name?: ReactNode

Who is speaking, on the line above the bubble.

optional time?: ReactNode

When it was said, or what the speaker is doing instead.

optional state?: ChatBubbleState

optional children?: ReactNode

const ChatBubble: ForwardRefExoticComponent<object & Omit<HTMLAttributes<HTMLDivElement>>, "children"> > & RefAttributes<HTMLDivElement>>>>

One turn of a conversation: who said it, when, and what. It owns the sides, the bubble and the still-writing dots; the caller owns the content.