@lg-chat/chat-window
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

Chat Window

Installation

Yarn

yarn add @lg-chat/chat-window

NPM

npm install @lg-chat/chat-window

Example

const Example = (props) => {
  const userName = "Sean Park";
  const [messages, setMessages] = useState<Array<any>>(baseMessages);

  const handleMessageSend = (messageBody: string) => {
    const newMessage = {
      messageBody,
      userName,
    };
    setMessages((messages) => [...messages, newMessage]);
  };

  return (
    <LeafyGreenChatProvider>
      <ChatWindow {...props}>
        <TitleBar title="LG Chat Demo" badgeText="Beta" />
        <MessageFeed>
          {messages.map((messageFields) => (
            <MyMessage key={messageFields.id} {...messageFields} />
          ))}
        </MessageFeed>
        <InputBar onMessageSend={handleMessageSend} />
      </ChatWindow>
    </LeafyGreenChatProvider>
  );
};

Properties

Prop Type Description Default
darkMode boolean Determines if the component should render in dark mode false
... HTMLElementProps<'div'> Props spread on root element

Readme

Keywords

none

Package Sidebar

Install

npm i @lg-chat/chat-window

Weekly Downloads

186

Version

2.0.1

License

Apache-2.0

Unpacked Size

50 kB

Total Files

32

Last publish

Collaborators

  • brookescarlett