gabrielcolson / botui-react

React wrapper for the BotUI API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BotUI-React

React wrapper for the BotUI API

Example

Getting Started

Installing

You can download the package from npm using npm or yarn

npm i botui-react

Or

yarn add botui-react

Usage

Link Vue.js and the BotUI script in your HTML file.

<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.0.5/vue.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/botui/build/botui.js"></script>

Import the component into your project.

import Botui from 'botui-react';

Instantiate it in your jsx.

<Botui ref={ cmp => this.botui = cmp } />

Create a conversation.

componentDidMount() {
    this.botui.message.bot({
        content: "Hello World",
        delay: 1000
    });
    this.botui.action.text({
        action: {
            placeholder: "Enter your text here"
        }
    });
}

For more examples, you can refer to the BotUI documentation.

License

This project is licensed under the MIT License

About

React wrapper for the BotUI API


Languages

Language:JavaScript 86.7%Language:HTML 10.9%Language:CSS 2.4%