Krizaka UI
Krizaka UI

Chat

A conversation's parts — MessageBubble (time, receipt, retry), TypingIndicator, MessageComposer, ConversationItem — the same API on the web and React Native.

Web · ✓Mobile · ✓Desktop · ✓BetaData display
Support level
Beta
Size
6.2 kB gzip, budget 7.6 kB
Who uses it
4 files of the live products and sites import it (Sovkora: 1) Counted in the dated inventory of 2026-11-23.
import { MessageBubble, TypingIndicator, MessageComposer, ConversationItem } from "@krizaka/ui/chat";

Web and mobile — the same component for React and React Native. Beta: its API may still change in a minor version.

Why it is here. Used by Sovkora, krizaka.com.

When to use

  • A creator app's messages, a community's chats, support threads.
  • An inbox of conversations with presence and unread counts.

When not to use

  • For a comments thread under a post.Use instead: List
  • For notifications.Use instead: Toast

Installation

Install

npm install @krizaka/ui @krizaka/tailwind @krizaka/tokens tailwindcss

Styles

@import "tailwindcss";
@import "@krizaka/tailwind";
@import "@krizaka/ui/tailwind.css";

Import

import { MessageBubble, TypingIndicator, MessageComposer, ConversationItem } from "@krizaka/ui/chat";

Examples

Conversation

Grouped runs, a read receipt, typing, the composer.

Inbox

Online, typing, unread counts.

Pill composer

One rounded field: chip and attach inside, round send inside, a status line under it.

Props

ConversationItem

A conversation in the list: avatar, name, the last message or typing, the time, the unread count.

PropTypeDefaultDescription
namerequiredstring—The other person's name.
previewrequiredstring—The last message, or “typing…”.
avatarstring | null—Their avatar's URL.
classNamestring—Classes merged on the row.
hrefstring—Opens the conversation (a link).
onlineboolean—Before the name: a presence dot (online).
onlineLabelstring—The presence in words (“online”).
onSelect(() => void)—Opens the conversation (a button).
timestring—When (“14:02”, “Mon”).
typingboolean—The preview is the typing signal: in the accent.
unreadnumber0Unread messages: a count, the name in bold.
unreadLabelstring—The unread count in words (“3 unread”).

MessageBubble

A message: yours in the accent on the right, theirs on the left, the time inside, the receipt under the last of yours.

PropTypeDefaultDescription
textrequiredstring—The text.
classNamestring—Classes merged on the row.
contextstring—A line above the text: what it answers.
grouped"middle" | "single" | "first" | "last"singlePart of a run of the same sender: the corner towards the next one is tighter.
labelsMessageBubbleLabels—The words, passed translated.
mineboolean—Yours (right, in the accent) or theirs (left).
onRetry(() => void)—Sends a failed message again (a button under it).
showStatusboolean—Show the status under the bubble (the last message of yours).
statusMessageStatus—Where a message of yours stands; shown when showStatus.
timestring—The time, written by the app (“14:02”).

MessageComposer

Where a message is written: a growing textarea (Enter sends, Shift+Enter a new line), an attach slot, a send button. The pill variant is the one-field look of the Krizaka chat card.

PropTypeDefaultDescription
onSendrequired() => void—Sends the draft (Enter, or the button); Shift+Enter adds a line.
onValueChangerequired(text: string) => void—Called on every key.
placeholderrequiredstring—The input's name and placeholder (“Message”).
sendLabelrequiredstring—The send button's name (“Send”).
valuerequiredstring—The draft (controlled).
busybooleanfalseAn answer is on its way: the send is held (and aria-busy is set) while the field stays where it is, size included.
canSendboolean—Overrides “the draft has text” — e.g. an attachment alone can be sent. A busy composer never sends.
classNamestring—Classes merged on the root.
disabledReasonstring—Cannot write: the reason in its place.
inputPropsOmit<Omit<DetailedHTMLProps<TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "ref">, "className" | ... 4 more ... | "rows">—Attributes (data-testid, autoFocus, id…) forwarded to the textarea.
leadingReactNode—Before the input: an attach button (bar), or the mode/model chip and attach, inside the field (pill).
maxLengthnumber4000The longest message. Default 4000.
sendPropsOmit<Omit<DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "className" | ... 2 more ... | "type">—Attributes forwarded to the send button.
statusReactNode—pill: the quiet line under the field (privacy, cost estimate). Its row is always reserved, so a changing line never moves the field. Read politely.
variant"pill" | "bar"barbar: a docked bar with a square-ish field. pill: one rounded field holding leading, the text and a round send button — no inner border. Default bar.

TypingIndicator

Three dots that breathe while the other person types, announced politely; still under reduced motion.

PropTypeDefaultDescription
labelrequiredstring—What is read and shown beside the dots (“Elena is typing”) — passed translated.
classNamestring—Classes merged on the root.
showLabelboolean—Show the words beside the dots.

Accessibility

  • Each bubble is read with its time; a failed one says so and offers a retry.
  • The pill status line is a polite live region; a busy composer holds the send (aria-busy) and says nothing else.
  • The typing dots are announced politely by their words.
  • A conversation row reads name, presence, last message, time and unread count.

Keyboard

KeysAction
Enter / Shift+EnterIn the web composer: send, or a new line.

Best practices

  • Group the runs of one sender (grouped); show the receipt under the last message of yours only.
  • Keep the server's order and merge (the app's), the bubble only draws.
  • The composer never clears itself: clear the draft once the message is sent.
  • variant="pill" for a chat page: put the mode/model chip and attach in leading, privacy and cost in status, and pass busy while an answer streams — the field's box does not move.

Generated from the code of @krizaka/ui 5.3.4: its meta.ts, its examples and its types.Edit this documentation on GitHub

On this page