Krizaka
Documentation

Chat

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

Web + MobileBêtaAffichage de données

Web et mobile — le même composant pour React et React Native. Bêta : son API peut encore changer à une version mineure.

Quand l’utiliser

  • Orochia's Messages, a dating app's chats, support threads.
  • An inbox of conversations with presence and unread counts.

Quand ne pas l’utiliser

  • For a comments thread under a post.À la place : List
  • For notifications.À la place : Toast

Installation

Installer

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

Styles

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

Importer

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

Exemples

Conversation

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

Hey! Loved your sunset photo 🌅19:02

Was it Cabo da Roca?19:02

It was! Have you been?19:05

We should go this weekend19:05

Read

Elena is typing

Inbox

Online, typing, unread counts.

Props

ConversationItem

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

PropTypeDéfautDescription
namerequisstring—The other person's name.
previewrequisstring—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.

PropTypeDéfautDescription
textrequisstring—The text.
classNamestring—Classes merged on the row.
contextstring—A line above the text: what it answers.
grouped"middle" | "first" | "last" | "single"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.

PropTypeDéfautDescription
onSendrequis() => void—Sends the draft (Enter, or the button); Shift+Enter adds a line.
onValueChangerequis(text: string) => void—Called on every key.
placeholderrequisstring—The input's name and placeholder (“Message”).
sendLabelrequisstring—The send button's name (“Send”).
valuerequisstring—The draft (controlled).
classNamestring—Classes merged on the root.
disabledReasonstring—Cannot write: the reason in its place.
leadingReactNode—Before the input: an attach button.
maxLengthnumber4000The longest message. Default 4000.

TypingIndicator

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

PropTypeDéfautDescription
labelrequisstring—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.

Accessibilité

  • Each bubble is read with its time; a failed one says so and offers a retry.
  • The typing dots are announced politely by their words.
  • A conversation row reads name, presence, last message, time and unread count.

Clavier

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

Bonnes pratiques

  • 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.

Générée depuis le code de @krizaka/ui 3.5.0 : son meta.ts, ses exemples et ses types.Modifier cette documentation sur GitHub

Sur cette page