{"id":16184298,"url":"https://github.com/mattmezza/react-beautiful-chat","last_synced_at":"2025-03-16T10:31:53.395Z","repository":{"id":50288679,"uuid":"121637046","full_name":"mattmezza/react-beautiful-chat","owner":"mattmezza","description":"A simple and beautiful React chat component backend agnostic and with Emoji and File support.","archived":false,"fork":false,"pushed_at":"2020-10-20T22:23:19.000Z","size":5554,"stargazers_count":117,"open_issues_count":9,"forks_count":34,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-02-27T07:43:58.414Z","etag":null,"topics":["chat","chat-component","emoji","file","react","reactjs"],"latest_commit_sha":null,"homepage":"https://mattmezza.github.io/react-beautiful-chat/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mattmezza.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-15T14:09:28.000Z","updated_at":"2024-12-19T16:26:27.000Z","dependencies_parsed_at":"2022-09-06T17:21:21.691Z","dependency_job_id":null,"html_url":"https://github.com/mattmezza/react-beautiful-chat","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattmezza%2Freact-beautiful-chat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattmezza%2Freact-beautiful-chat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattmezza%2Freact-beautiful-chat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattmezza%2Freact-beautiful-chat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mattmezza","download_url":"https://codeload.github.com/mattmezza/react-beautiful-chat/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243814895,"owners_count":20352036,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chat","chat-component","emoji","file","react","reactjs"],"created_at":"2024-10-10T07:09:45.115Z","updated_at":"2025-03-16T10:31:52.445Z","avatar_url":"https://github.com/mattmezza.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# react-beautiful-chat\n\n`react-beautiful-chat` provides an intercom-like chat window that can be included easily in any project for free. It provides no messaging facilities, only the view component.\n\n`react-beautiful-chat` is an improved version of `react-chat-window` (which you can find [here](https://github.com/kingofthestack/react-live-chat))\n\n\u003ca href=\"https://www.npmjs.com/package/react-beautiful-chat\" target=\"\\_parent\"\u003e\n  \u003cimg alt=\"\" src=\"https://img.shields.io/npm/dm/react-beautiful-chat.svg\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://github.com/mattmezza/react-beautiful-chat\" target=\"\\_parent\"\u003e\n  \u003cimg alt=\"\" src=\"https://img.shields.io/github/stars/mattmezza/react-beautiful-chat.svg?style=social\u0026label=Star\" /\u003e\n\u003c/a\u003e\n\n![gif](https://media.giphy.com/media/3ohs4wE4DqXw84xAMo/giphy.gif)\n\n## Features\n\n- Customizeable\n- Backend agnostic\n- Free\n\n## [Demo](https://mattmezza.github.io/react-beautiful-chat/)\n\n## Table of Contents\n- [Installation](#installation)\n- [Example](#example)\n- [Components](#api)\n\n## Installation\n\n```\n$ npm install react-beautiful-chat\n```\n\n## Example\n\n``` javascript\nimport React, {Component} from 'react'\nimport {render} from 'react-dom'\nimport {Launcher} from '../../src'\n\nclass Demo extends Component {\n\n  constructor() {\n    super();\n    this.state = {\n      messageList: messageHistory\n    };\n  }\n\n  _onMessageWasSent(message) {\n    this.setState({\n      messageList: [...this.state.messageList, message]\n    })\n  }\n\n  _sendMessage(text) {\n    if (text.length \u003e 0) {\n      this.setState({\n        messageList: [...this.state.messageList, {\n          author: 'them',\n          type: 'text',\n          data: { text }\n        }]\n      })\n    }\n  }\n\n  render() {\n    return (\u003cdiv\u003e\n      \u003cLauncher\n        agentProfile={{\n          teamName: 'react-beautiful-chat',\n          imageUrl: 'https://a.slack-edge.com/66f9/img/avatars-teams/ava_0001-34.png'\n        }}\n        onMessageWasSent={this._onMessageWasSent.bind(this)}\n        messageList={this.state.messageList}\n        showEmoji\n      /\u003e\n    \u003c/div\u003e)\n  }\n}\n```\n\nFor more detailed examples see the demo folder.\n\n## Components\n\n# Launcher\n\n`Launcher` is the only component needed to use react-beautiful-chat. It will react dynamically to changes in messages. All new messages must be added via a change in props as shown in the example.\n\nLauncher props:\n\n|prop | type   | description |\n|-----|--------|---------------|\n| *agentProfile | object | Represents your product or service's customer service agent. Fields: teamName, imageUrl|\n| onMessageWasSent | function(message) | Called when a message a message is sent with a message object as an argument. |\n| messageList | [message] | An array of message objects to be rendered as a conversation. |\n| showEmoji | bool | A bool indicating whether or not to show the emoji button\n| showFile | bool | A bool indicating whether or not to show the file chooser button\n| onKeyPress | func | A function `(userInput) =\u003e console.log(userInput)` used to do something with the user input. The function is invoked debounced at 300ms\n| onDelete | func | A function `(msg) =\u003e console.log(msg)` used to delete a sent message. If this props is set, a delete button will be shown in the top right corner of each message sent by the user to a partner. You can set any property on the message object (an `id` property for instance) and then use this property to call some backend api to delete the message.\n\n\n### Message Objects\n\nMessage objects are rendered differently depending on their type. Currently, only text and emoji types are supported. Each message object has an `author` field which can have the value 'me' or 'them'.\n\n``` javascript\n{\n  author: 'them',\n  type: 'text',\n  data: {\n    text: 'some text'\n  }\n}\n\n{\n  author: 'me',\n  type: 'emoji',\n  data: {\n    code: 'someCode'\n  }\n}\n\n{\n  author: 'me',\n  type: 'file',\n  data: {\n    name: 'file.mp3',\n    url: 'https:123.rf/file.mp3'\n  }\n}\n\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattmezza%2Freact-beautiful-chat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmattmezza%2Freact-beautiful-chat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattmezza%2Freact-beautiful-chat/lists"}