Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-chat-elements

Package Overview
Dependencies
Maintainers
1
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-chat-elements

Reactjs chat components

  • 0.4.4
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

react-chat-elements

Reactjs chat elements

Components

  1. ChatItem
  2. MessageBox
  3. SystemMessage
  4. MessageList
  5. ChatList
  6. Input
  7. Button
  8. Popup
  9. SideBar
  10. Navbar
  11. Dropdown

ChatItem Component

chatitem-photo

import { ChatItem } from 'react-chat-elements'

<ChatItem
    avatar={'https://facebook.github.io/react/img/logo.svg'}
    alt={'Reactjs'}
    title={'Facebook'}
    subtitle={'What are you doing?'}
    date={new Date()}
    unread={0} />
ChatItem props
propdefaulttypedescription
avatarnonestringChatItem avatar photo url
altnonestringChatItem avatar photo alt text
titlenonestringChatItem title
subtitlenonestringChatItem subtitle
datenonedateChatItem date
unread0intChatItem unread count
onClicknonefunctionChatItem on click

MessageBox Component

filephototext
file-messagephoto-message  text-message
import { MessageBox } from 'react-chat-elements'

<MessageBox
    position={'left'}
    type={'photo'}
    text={'react.svg'}
    data={{
        uri: 'https://facebook.github.io/react/img/logo.svg',
        status: {
            click: false,
            loading: 0,
        }
    }}/>
MessageBox props
propdefaulttypedescription
position leftstring message box position
type textstring message type (text, photo, file)
textnonestring message text
data {}objectmessage data

SystemMessage Component

import { SystemMessage } from 'react-chat-elements'

<SystemMessage
    text={'End of conversation'}/>
SystemMessage props
propdefaulttypedescription
textnonestring message text

MessageList Component

messagelist-photo

import { MessageList } from 'react-chat-elements'

<MessageList
    className='message-list'
    lockable={true}
    toBottomHeight={'100%'}
    dataSource={[
        {
            position: 'right',
            type: 'text',
            text: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit',
            date: new Date(),
        },
        .
        .
        .
    ]} />
MessageList props
propdefaulttypedescription
classNamenonestringoptional message list className
dataSource[]arraymessage list array
lockablefalsebooleanIt locks to scroll position when the dataSource has been changed
toBottomHeight300int or string(only '100%')If the toBottomHeight property's value higher than bottom value of the scrollbar when the data source has been changed Scrollbar goes to bottom at the end of the page. If the toBottomHeight property's value has been set '100%', scrollbar goes to bottom at the end of the page when the data source has been changed.
onClicknonefunctionmessage list item on click (message(object) is returned)

ChatList Component

chatlist-photo

import { ChatList } from 'react-chat-elements'

<ChatList
    className='chat-list'
    dataSource={[
        {
            avatar: 'https://facebook.github.io/react/img/logo.svg',
            alt: 'Reactjs',
            title: 'Facebook',
            subtitle: 'What are you doing?',
            date: new Date(),
            unread: 0,
        },
        .
        .
        .
    ]} />
ChatList props
propdefaulttypedescription
classNamenonestringoptional chat list className
dataSource[]arraychat list array
onClicknonefunctionchat list item on click (chat(object) is returned)

Input Component

import { Input } from 'react-chat-elements'

<Input
    placeholder="Type here..."
    multiline={true}
    buttons={
        <Button
            color='white'
            backgroundColor='black'
            text='Send'/>
    }/>
Input props
propdefaulttypedescription
classNamenonestringoptional input className
placeholdernonestringinput placeholder text
defaultValuenonestringinput default value
onChangenoneobjectinput onChange function
multilinefalseboolinput is textarea
autoHeighttrueboolinput auto height
minHeight25intinput min height
maxHeight200intinput max height
inputStylenoneobjectinputStyle object

Button Component

import { Button } from 'react-chat-elements'

<Button
    text={'click me!'} />
Button props
propdefaulttypedescription
typenonestringbutton type (outlined, transparent)
disablednonestringbutton is disabled?
textnonestringbutton text

Popup Component

import { Popup } from 'react-chat-elements'

<Popup
    show={this.state.show}
    header='Lorem ipsum dolor sit amet.'
    headerButtons={[{
        type: 'transparent',
        color:'black',
        text: 'close',
        onClick: () => {
            this.setState({show: false})
        }
    }]}
    text='Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatem animi veniam voluptas eius!'
    footerButtons={[{
        color:'white',
        backgroundColor:'#ff5e3e',
        text:"Vazgeç",
    },{
        color:'white',
        backgroundColor:'lightgreen',
        text:"Tamam",
    }]}/>
Popup props
propdefaulttypedescription
showfalseboolpopup visible
headernonestringpopup title (header) message
headerButtonsnonearraypopup title (header) buttons
textnonestringpopup content (center) message
color#333string (color)popup content message color
footerButtonsnonearraypopup footer buttons
renderHeadernonefunction (component)render header function
renderContentnonefunction (component)render content function
renderFooternonefunction (component)render footer function

SideBar Component

import { SideBar } from 'react-chat-elements'

<SideBar
    top={
        <div>'TOP' area</div>
    }
    center={
        <div>'CENTER' area</div>
    }
    bottom={
        <div>'BOTTOM' area</div>
    }/>
SideBar props
propdefaulttypedescription
typedarkstringpopup visible
topfalsefunction (component)popup top component
centernonefunction (component)popup center component
bottomnonefunction (component)popup bottom component

Navbar Component

import { Navbar } from 'react-chat-elements'

<Navbar
    top={
        <div>'TOP' area</div>
    }
    center={
        <div>'CENTER' area</div>
    }
    bottom={
        <div>'BOTTOM' area</div>
    }/>
Navbar props
propdefaulttypedescription
typedarkstringpopup visible
topfalsefunction (component)popup top component
centernonefunction (component)popup center component
bottomnonefunction (component)popup bottom component

Dropdown Component

import { Dropdown } from 'react-chat-elements'

<Dropdown
    target={{
        X: 400,
        Y: 100
    }}
    items={[
        'merhaba',
        'lorem',
        'ipsum',
        'dolor',
        'sit',
        'amet'
    ]}/>
Dropdown props
propdefaulttypedescription
animationTypenonestringfade or default
animationPositionnortweststringanimation start position (nortwest, norteast, southwest, southeast)
itemsnonearraydropdown items array
onSelectnonefunctionitem on select
target{ X: 0, Y: 0 }objectdropdown target

Keywords

FAQs

Package last updated on 23 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc