0.1.2 • Published 9 months ago
@samagra-x/stencil-molecules v0.1.2
Features
- 😎 Best Practices: The best practice for chat interaction based on our experience of Alime Chatbot
- 🛡 TypeScript: Written in TypeScript with predictable static types
- 📱 Responsive: Responsive design to adapt automatically to whatever device
- ♿ Accessibility: Accessibility support and get the certification from Accessibility Research Association
- 🎨 Theming: Powerful theme customization in every detail
- 🌍 International: Internationalization support for dozens of languages
Environment Support
- Modern browsers (support CSS Variables)
- Internet Explorer 11 (with polyfills and CSS Variables Polyfill / css-vars-ponyfill)
Edge | Firefox | Chrome | Safari | iOS Safari | Android WebView |
---|---|---|---|---|---|
16+ | 31+ | 49+ | 9.1+ | 9.3+ | 6+ |
Install
npm install @samagra-x/stencil-chatui
yarn add @samagra-x/stencil-chatui
Usage
import Chat, { Bubble, useMessages } from '@samagra-x/stencil-chatui';
import '@samagra-x/stencil-chatui/dist/index.css';
const App = () => {
const { messages, appendMsg, setTyping } = useMessages([]);
function handleSend(type, val) {
if (type === 'text' && val.trim()) {
appendMsg({
type: 'text',
content: { text: val },
position: 'right',
});
setTyping(true);
setTimeout(() => {
appendMsg({
type: 'text',
content: { text: 'Bala bala' },
});
}, 1000);
}
}
function renderMessageContent(msg) {
const { content } = msg;
return <Bubble content={content.text} />;
}
return (
<Chat
navbar={{ title: 'Assistant' }}
messages={messages}
renderMessageContent={renderMessageContent}
onSend={handleSend}
/>
);
};
Development
cd storybook
npm i
npm run storybook
License
MIT
0.1.2
9 months ago
0.1.1
9 months ago
0.1.0
9 months ago
0.0.25
9 months ago
0.0.22
9 months ago
0.0.23
9 months ago
0.0.24
9 months ago
0.0.20
11 months ago
0.0.21
10 months ago
0.0.19
11 months ago
0.0.18
11 months ago
0.0.17
11 months ago
0.0.16
12 months ago
0.0.15
12 months ago
0.0.14
12 months ago
0.0.13
12 months ago
0.0.12
1 year ago
0.0.11
1 year ago
0.0.10
1 year ago
0.0.9
1 year ago
0.0.8
1 year ago
0.0.7
1 year ago
0.0.6
1 year ago
0.0.5
1 year ago
0.0.4
1 year ago