Scriv Chat Component
A Web Component built with Stencil that allows you to add a chat dialog to a web page
that is connected to a public Scriv bot.
Getting Started
To try this component out, run:
npm install
npm start
Now load the localhost URL shown in the console in your browser.
Note that this requires you to have Scriv running locally on port 8000. If you want to change that, edit
the src/index.html
file and change the scriv
property on the scriv-chat
element.
To build the component for production, run:
npm run build
To run the unit tests for the components, run:
npm test
Making Changes
To make changes to the component, you can edit the files in the src/components/scriv-chat
directory. You can
also edit the src/index.html
file to change the page that is loaded when you run npm start
.
Styling
The component uses Tailwind CSS with DaisyUI for styling.
Using this component
There are three strategies we recommend for using web components built with Stencil.
The first step for all three of these strategies is to publish to NPM.
Script tag
- Put a script tag similar to this
<script type='module' src='https://unpkg.com/scriv-chat@0.0.1/dist/scriv-chat.esm.js'></script>
in the head of your index.html - Then you can use the element anywhere in your template, JSX, html etc
Node Modules
- Run
npm install scriv-chat --save
- Put a script tag similar to this
<script type='module' src='node_modules/scriv-chat/dist/scriv-chat.esm.js'></script>
in the head of your index.html - Then you can use the element anywhere in your template, JSX, html etc