A modern, responsive chatbot component built with React and TypeScript. Features a floating chat icon that opens a beautiful chat window, similar to support chatbots found on many websites.
- 🎨 Modern Design: Beautiful gradient UI with smooth animations
- 💬 Interactive Chat: Real-time messaging with typing indicators
- 📱 Responsive: Works perfectly on desktop and mobile devices
- ⚡ Fast: Built with Vite for lightning-fast development
- 🎯 TypeScript: Fully typed for better development experience
- 🔧 Customizable: Easy to modify and extend
The chatbot includes:
- Floating chat icon in the bottom-right corner
- Smooth slide-up animation when opening
- Auto-responses to common greetings and questions
- Typing indicator for bot responses
- Message timestamps
- Scrollable message history
- Responsive design that adapts to mobile screens
- Node.js (version 20.19+ or 22.12+)
- npm or yarn
-
Clone or download this project
-
Install dependencies:
npm install
-
Start the development server:
npm run dev
-
Open your browser and navigate to
http://localhost:5173/
npm run buildThe built files will be in the dist directory.
The chatbot is already integrated into the main App component. Simply click the chat icon in the bottom-right corner to start chatting.
You can customize the chatbot by modifying:
src/components/ChatBot.tsx- Main component logicsrc/components/ChatBot.css- Styling and animations- Response logic - Update the
generateResponsefunction to customize bot responses
- Change Colors: Modify the gradient colors in the CSS file
- Add API Integration: Replace the mock
generateResponsefunction with actual API calls - Modify Position: Change the
bottomandrightproperties in CSS - Add Features: Extend with file uploads, emoji picker, or rich text support
src/
├── components/
│ ├── ChatBot.tsx # Main chatbot component
│ └── ChatBot.css # Chatbot styles
├── App.tsx # Main app component
└── main.tsx # App entry point
- React 18 - UI library
- TypeScript - Type safety
- Vite - Build tool and dev server
- CSS3 - Styling with animations and gradients
- Chrome (latest)
- Firefox (latest)
- Safari (latest)
- Edge (latest)
Feel free to submit issues and enhancement requests!
This project is open source and available under the MIT License.
export default tseslint.config([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Remove tseslint.configs.recommended and replace with this
...tseslint.configs.recommendedTypeChecked,
// Alternatively, use this for stricter rules
...tseslint.configs.strictTypeChecked,
// Optionally, add this for stylistic rules
...tseslint.configs.stylisticTypeChecked,
// Other configs...
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])You can also install eslint-plugin-react-x and eslint-plugin-react-dom for React-specific lint rules:
// eslint.config.js
import reactX from 'eslint-plugin-react-x'
import reactDom from 'eslint-plugin-react-dom'
export default tseslint.config([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Enable lint rules for React
reactX.configs['recommended-typescript'],
// Enable lint rules for React DOM
reactDom.configs.recommended,
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])