New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

vue-bot-ui

Package Overview
Dependencies
Maintainers
0
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-bot-ui

Chatbot UI using Vue.js 2

  • 0.2.11
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
105
decreased by-41.34%
Maintainers
0
Weekly downloads
 
Created
Source

Vue Bot UI

For the one who is finding a customizable chatbot UI.

I build for my private project, but I tried to bring as many options as I think someone need it, so feel free to use it.

Demo page is coming soon.

vue bot UI

Install

npm install vue-bot-ui

// or
yarn add vue-bot-ui

Usage

Import & register the component

import { VueBotUI } from 'vue-bot-ui'

export default {
  components: {
    VueBotUI,
  },
  ...
}

And use it:

<VueBotUI
  :messages="data"
  :options="botOptions"
  @msg-send="messageSendHandler"
/>
data () {
  return {
    data: [], // See Data example below
    botOptions: {
      // See the list of options below
    }
  }
}

Props

List of available props to use in the component:

NameTypeDefaultDescription
messagesArray[]Required. Data of Messages
optionsObjectsee belowSome options to customize UI
bot-typingBooleanfalseIf true, the bot typing indicator will show
input-disableBooleanfalseIf true, message input will be disabled
is-openBooleanfalseIf true, the board will open from init
open-delayNumberundefinedDelay before opening from init (in ms). Requires is-open to be true

Options

List of available options to customize UI:

NameTypeDefaultDescription
botTitleString'Chatbot'The bot name that will be shown on header of the board
colorSchemeString'#1b53d0'Background color of bubble button & board header
textColorString'#fff'Color of bubble button icon & board header title
bubbleBtnSizeNumber56Size of bubble button (px)
animationBooleantrueSet to false to disable animation of bubble button icon & board showing
boardContentBgString'#fff'Background color of board messages box
botAvatarSizeNumber32Size of bot avatar (px)
botAvatarImgString'http://placehold.it/200x200'Avatar image
msgBubbleBgBotString'#f0f0f0'Background color of Bot message
msgBubbleColorBotString'#000'Text color of Bot message
msgBubbleBgUserString'#4356e0'Background color of user message
msgBubbleColorUserString'#fff'Text color of user message
inputPlaceholderString'Message'The placeholder for message input
inputDisableBgString'#fff'Background color for the disabled input, mixed with opacity: 0.2
inputDisablePlaceholderStringnullPlaceholder message for disabled input

Components & Events

This is the most important part you need to know, because you need these to integrate your bot API. Take a look my App.vue file if you need an example.

Events

NameParamsDescription
initFire everytime the board is opened
msg-sendvalue (Object)Fire when user hit Send or select an option
destroy Fire when board is closed

Use msg-send to get the message from user and trigger request to bot API.

Trigger Events:

NameDescription
botui-openTo open the board
botui-closeTo close the board
botui-toggleTo toggle open/close the board

Components

Common pattern / Example data:

const messages = [
  {
    agent: 'bot', // Required. 'bot' or 'user'
    type: 'text', // Required. Bubble message component type: 'text' / 'button'
    text: 'Hello. How can I help you', // Required. The message
    disableInput: false, // Disable message input or not
    ...
  },
  {
    agent: 'user',
    type: 'text', // always
    text: 'I need a new laptop',
  },
  ...
]

Component list:

Current components supported by this package, path to files: components/MessageBubble/..

  • SingleText - type: 'text'
{
  agent: 'bot',
  type: 'text',
  text: 'Hello. How can I help you',
  disableInput: false,
}
  • ButtonOptions - type: 'button'
{
  agent: 'bot',
  type: 'button',
  text: 'Select the option below',
  disableInput: true,
  options: [
    {
      text: 'Open Google',
      value: 'https://google.com',
      action: 'url'
    },
    {
      text: 'Submit Support Ticket',
      value: 'submit_ticket',
      action: 'postback' // Request to API
    },
    ...
  ],
}
  • Other components are coming soon...

Slots

List of available slots:

NameDescription
headerBoard header, that contains Bot name.
actionsThe slot beside Send button in the input message. You can add extra actions here (emoji, attach,...)
sendButtonSend button icon, you can change it to text.
bubbleButtonBubble button that contains BubbleIcon & CloseIcon as default.
botTypingBot Typing message bubble that contains 3 dots indicator as default.

Not found what your need?

You can overwrite the CSS by class name. Each type and state has separate class for you to customize.

Feature request: Feel free to open an issue to ask for a new feature.

Developers / Build

# Clone repo
git clone https://github.com/JuzSer/vue-bot-ui

# Install packages
yarn

# Development & Demo - http://localhost:1901
yarn serve

# Build main library
yarn build-bundle

Todo:

Many things...

  • Events
  • Loading / Typing indicators
  • Disable message input on loading, vice versa...
  • Properties for target of button options
  • Add more message bubble components (video, images,...)
  • Add more events
  • Test
  • Accessibility

Thanks

Contributors

Thank you! :tada:

Keywords

FAQs

Package last updated on 18 Sep 2024

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