Configurable AI chat widget built as native web component
MIT License
Warning This is a learning project. It's not meant to be used in production environments.
Work in progress This is a native web component which provides basic AI chat functionality (single question, no history).
$ npm i @rumenpetrov/ai-chat-widget
// index.js
import '@rumenpetrov/ai-chat-widget'
<script type="module" src="https://esm.sh/@rumenpetrov/ai-chat-widget/dist/bundle.js"></script>
<!-- Quick light/dark theme example -->
<!doctype html>
<html lang="en">
<head>
...
<style>
:root {
color-scheme: light dark;
font-family: system-ui, sans-serif;
color: #213547;
background-color: #ffffff;
/* All generated tokens from the light theme you got form Material Theme Builder */
--md-sys-color-primary: rgb(65 95 145);
--md-sys-color-surface-tint: rgb(65 95 145);
...
}
@media (prefers-color-scheme: dark) {
:root {
color: rgba(255, 255, 255, 0.87);
background-color: #242424;
/* All generated tokens from the dark theme you got form Material Theme Builder */
--md-sys-color-primary: rgb(170 199 255);
--md-sys-color-surface-tint: rgb(170 199 255);
...
}
}
}
</style>
...
</head>
<body>
...
</body>
</html>
<acw-root></acw-root>