Skip to content

WenBoWeb/ChatUI

 
 

Repository files navigation

ChatUI

The UI design language and React library for Chatbot UI

Website:https://chatui.io

English | 简体中文

Features

  • The best practice for chatbot interaction and design based on our experience of Alime Chatbot
  • Written in TypeScript with predictable static types
  • Responsive design to adapt automatically to whatever device
  • Accessibility support and get the certification from Accessibility Research Association
  • Powerful theme customization in every detail
  • Internationalization support for dozens of languages

Environment Support

Edge
Edge
Firefox
Firefox
Chrome
Chrome
Safari
Safari
iOS Safari
iOS Safari
Android WebView
Android WebView
16+ 31+ 49+ 9.1+ 9.3+ 6+

Install

npm install @chatui/core --save
yarn add @chatui/core

Usage

import Chat, { Bubble, useMessages } from '@chatui/core';
import '@chatui/core/dist/index.css';

const App = () => {
  const { messages, appendMsg, setTyping } = useMessages([]);

  function handleSend(type, val) {
    if (type === 'text' && val.trim()) {
      appendMsg({
        type: 'text',
        content: { text: val },
        position: 'right',
      });

      setTyping(true);

      setTimeout(() => {
        appendMsg({
          type: 'text',
          content: { text: 'Bala bala' },
        });
      }, 1000);
    }
  }

  function renderMessageContent(msg) {
    const { content } = msg;
    return <Bubble content={content.text} />;
  }

  return (
    <Chat
      navbar={{ title: 'Assistant' }}
      messages={messages}
      renderMessageContent={renderMessageContent}
      onSend={handleSend}
    />
  );
};

Theme

Visit Customize Theme for detail

Internationalization

Visit i18n for detail

Discussion

License

MIT

About

The UI design language and React library for Chatbot UI

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 77.0%
  • Less 20.5%
  • JavaScript 2.5%