Timeline
Follow what happened, newest first, grouped by day.
A chat thread with grouped messages, reactions, read receipts, typing, and a composer with attachments.
npx shadcn@latest add @silicon-ui/chat-threadnpx shadcn@latest add @silicon-ui/chat-threadInstall the dependencies.
npm install lucide-react motionCopy these files into your project. Shared files are skipped if you already have them.
components/silicon-ui/chat-thread/chat-thread.tsxcomponents/silicon-ui/chat-thread/chat-thread.module.cssInstall the foundation once per app for the design and motion tokens: npx shadcn@latest add @silicon-ui/silicon-foundation
ChatThread| Prop | Type | Default |
|---|---|---|
participants* | ChatParticipant[] | — |
currentUserId* | string | — |
messagesControlled messages, oldest first. Leave it out to let the thread keep its own list. | ChatMessage[] | — |
defaultMessages | ChatMessage[] | — |
typingParticipant ids currently typing. | string[] | [] |
readByThe last message each participant has read, by participant id. Their avatar sits under that message and glides as it moves. | Record<string, string> | — |
onSendCalled with the composer's text and files. Uncontrolled threads also append the message themselves. | (draft: ChatDraft) => void | Promise<void> | — |
onReact | (messageId: string, emoji: string) => void | — |
onRetry | (messageId: string) => void | — |
reactionsEmoji offered by the reaction picker. | string[] | DEFAULT_REACTIONS |
placeholder | string | "Message" |
composerShow the composer. Defaults to true. | boolean | true |
allowAttachments | boolean | true |
acceptFile types the attach button offers, as for `<input accept>`. | string | — |
groupWindowMessages from one person closer together than this, in ms, share a group. Defaults to five minutes. | number | 5 * 60_000 |
locale | string | "en-US" |
labelAccessible name of the message log. | string | "Conversation" |
labelsWords for localization. Leave out any key to keep its English default. | ChatThreadLabels | — |
className | string | — |
Also accepts the props of HTMLAttributes.
ChatComposer| Prop | Type | Default |
|---|---|---|
onSend* | (draft: ChatDraft) => void | — |
placeholder | string | "Message" |
allowAttachments | boolean | true |
accept | string | — |
disabled | boolean | — |
labelsWords for localization. Leave out any key to keep its English default. | ChatComposerLabels | — |
className | string | — |
Also accepts the props of HTMLAttributes.