Catalog npm
PACKAGE EXPLORERView in registry

10xanswers

npm

A fully customizable, draggable chatbot component built with React and Recoil for your next project.

100xdevsaiai chatbot componentchatbotchatbot npm packagechatbot stylingchatbot ui componentcomponentconversational-uicustom chatbot componentcustomizable chatbotdrag-and-drop chatbotdraggabledraggable chatbotfrontend chatbotgemini
All keywords (30)
gemini api chatbotinteractive chatbotinternet status hookmarkdown chatbotmarkdown rendering chatbotopen-source chatbotplug-and-play chatbotreactreact chatbotreact hooks chatbotreact recoil chatbotreact state managementrecoil chatbotrecoil state management
Versions collected56
Direct dependencies33From release 1.1.18
Last observed20 Oct, 18:02 UTC

README

Current package documentation

10xAnswers: ChatBot Component

10xAnswers is an easy-to-integrate, fully customizable, and draggable chatbot component built with React and Recoil. It allows you to add an intelligent chatbot to your project with minimal effort—no need to build one from scratch. Simply configure the prompt and provide the backend URL (or use our hosted service if you don’t want to build the backend yourself).

With 10xAnswers, you get both the frontend component and a backend solution, streamlining the process of adding a chatbot to your project. Just provide the URL and you're good to go—whether you want to build your own backend or use our hosted solution.

npm version License Downloads

Write-up: How 10xAnswers works, by Rajveer Singh

10xAnswers Banner

Table of Contents

  1. Introduction
  2. Demo
  3. Features
  4. Installation
  5. Quick Example
  6. Props
  7. Advanced Usage
  8. All Props
  9. Prompt Guidelines
  10. Gemini API Integration
  11. Backend Integration
  12. Warnings and Important Notes
  13. Screenshots
  14. Upcoming Features
  15. Author
  16. Contribution and Support

Demo

Screenshot 2024-12-03 at 12 19 56 PM Screenshot 2024-12-03 at 12 20 55 PM

See Live Demo and Customization:

You can see the 10xAnswers chatbot in action, customize its appearance, behavior, and features, and even get the exact code to integrate it into your own website!

Visit the demo and customization page at: https://10x-answers.vercel.app/ Try adjusting the settings to see how the chatbot reacts to different configurations. After customizing the chatbot, you can copy the generated code and implement it directly into your project to use the same customized bot on your website.

Features

  • Plug-and-Play: Simple to install and use.
  • Awesome UI: The chat bot has clean modern UI, so it would look great on your project.
  • Customizable: Style the chat window, bot icon, and entire chat component as per your needs.
  • Markdown Support: Render rich text, including code blocks and tables, in chatbot responses.
  • Editable User Input: Users can modify their questions and easily copy responses.
  • State Management with Recoil: Optimized state handling to ensure smooth performance.
  • Connectivity Check: Includes a custom hook to display internet connectivity status.
  • Draggable Interface: Move the chatbot around the screen for an optimal user experience and flexible placement.
  • Backend Support: Option to use your backend or provided URL for response generation.
  • Open Source: Fully accessible codebase for contributions and enhancements.
  • Future Features: Media and voice support, as well as additional themes, are coming soon.

Installation

npm install 10xanswers
# or
yarn add 10xanswers
# or
pnpm add 10xanswers

Quick Example

import React from 'react';
import { ChatBot } from '10xanswers';

function App() {
  return (
      <ChatBot 
        backendUrl="https://ask-10x-questions.vercel.app/" 
        prompt="Act as an artist and answer questions in a creative and stylistic manner." 
      />
  );
}

export default App;

Important: The provided URL https://ask-10x-questions.vercel.app/ is a pre-configured backend that works seamlessly with the 10xAnswers component.

⚠️ React 19 Incompatibility (Important)

❌ 10xAnswers (v1.1.14 and earlier) is NOT compatible with React 19

This is due to its dependency on Recoil v0.7.7, which is built for React 18 and hasn't been updated to support React 19's internal changes.

Attempting to use 10xAnswers with React 19 may cause errors like:

Uncaught TypeError: Cannot read properties of undefined (reading 'ReactCurrentDispatcher')

To avoid compatibility issues, use React 18.x with 10xAnswers.

If you've already set up your project with React 19, you can downgrade to React 18 by following these steps:


1. Modify package.json

Update the dependencies section as follows:

{
  "dependencies": {
    "10xanswers": "^1.1.14",
    "react": "^18.2.0",
    "react-dom": "^18.2.0"
  },
  "devDependencies": {
    "@types/react": "^18.2.0",
    "@types/react-dom": "^18.2.0"
  }
}

💡 You can also use any other stable React 18 version, like ^18.3.1.


2. Reinstall Dependencies

Install everything again using your package manager:

npm install
# or
yarn install
# or
pnpm install

Ongoing Improvement (Migrating to Zustand)

I’m currently overhauling the state management solution, shifting away from Recoil to Zustand, which is fully compatible with React 19. Once complete, 10xAnswers will work seamlessly with the latest React release.

⭐ Want to help? I welcome any contributions toward this migration!

Props

Basic Props

PropTypeDefaultDescription
backendUrlstring-Backend URL for chat processing, required
geminiApistring-Gemini API key for direct integration if no backend availaible(not recommended)
titlestring"10xAnswers"Chat window title
draggablebooleanfalseEnable/disable dragging
startOpenbooleanfalseInitial chat window state(open/colsed)

Styling Props

PropTypeDefaultDescription
chatWindowStyleobject{}Inline styles for chat window
chatBotIconStyleobject{}Inline styles for bot icon
chatComponentStyleobject{}Inline styles for chat component

Advanced Usage

<ChatBot 
  backendUrl="https://ask-10x-questions.vercel.app/"
  title="100xQuestions"
  stylizeTitle={{emphasized:"100x",normal:"Questions"}}//this field is optional, but recommended
  botIcon="./logoImg2.jpg"
  userIcon="./logoImg.jpg"
  draggable={true}
  x={500}
  y={625}
  prompt="You're and artisted turned developer, not respond accordingly"
  description="AI-powered conversational assistant"
  cta="Start Asking"
  startOpen={true}
  chatWindowStyle={{backgroundColor: #090909}}//if you want to change the background color, you can simply do it in the window
/>

All Props

Props

Prop NameTypeDescription
chatWindowStyleObjectInline CSS for chat window styling.
chatBotIconStyleObjectInline CSS for bot icon styling.
chatComponentStyleObjectInline CSS for overall chat component styling.
chatWindowClassNameStringTailwind classes for chat window styling.
chatBotIconClassNameStringTailwind classes for bot icon styling.
backendUrlStringRequired if no Gemini API is provided. URL for backend to process requests.
titleStringCustom title for the chatbot window.
botIconStringPath to the bot icon image.
userIconStringPath to the user icon image.
stylizeTitleObjectObject with emphasized and normal strings to style the title.
promptStringCustom prompt for the chatbot. Use "none" for no prompting.
geminiApiStringRequired if no backendUrl is provided.
themeStringTheme for the chatbot (currently not implemented).
draggableBooleanEnable or disable draggable functionality.
xNumberInitial x-position for draggable mode.
yNumberInitial y-position for draggable mode.
descriptionStringDescription text for the chatbot.
ctaStringCall-to-action text for the chatbot button.
startOpenBooleanWhether the chatbot window starts open (true) or closed (false).

Prompt Guidelines

  • With prompt: If a custom prompt is provided, it will be sent along with the user question.
  • Without prompt: If prompt is set to "none", only the user question with no prompt is sent to the ai model- not recommended.

Example Prompts

Default Prompt:
If no prompt is provided, default prompt will be sent to the model along with the questions asked by client

You are 10xAnswers, an intelligent and highly versatile chatbot. Your purpose is to assist users with precision, accuracy, and clarity...

Custom Prompt: You can specify your custom prompts here, every question of client will be sentto model along with this prompt

User is sending a custom prompt about behavior. Prompt: ${prompt}. Question: ${question}. History: ${chatHistory}.

Gemini API Integration

If you don't have a working backend you can directly use Google's Gemini API and pass it in the props, and send requests to the gemini directly from frontend. Not recommended as this exposes the api key to the users of your web app.

Backend Integration

URL-based Integration

POST requests are sent to backend with the following payload:

{
  "method": "POST",
  "body": {
    "contents": [{
      "parts": [{"text": "User question"}]
    }]
  }
}

Warning and Important Notes

Development Caution:

  • After changing any prop of the chat component, changes will only be visible after reloading.
  • Exposing Gemini API key directly in frontend is NOT recommended as it exposes your key to users.
  • Since the z-index of chatbot component is set to 999, it might give some troubles while building your site, you can change the z-ndex of component by applying styles in the chatComponent coinatiner. Example: jsx <ChatBot chatComponentStyle={{zIndex:1}}/>

Screenshots

Screenshots

file (4)Screenshot 2
Screenshot 3Screenshot 4

Example Usage

Screenshot 2024-12-02 at 3 18 29 AM

Upcoming Features

  • Media message support
  • Voice interaction modes
  • Additional themes
  • Enhanced customization options

Author

Rajveer Singh

Contribution and Support

Found an issue? Open a GitHub Issue

Enjoying 10xAnswers? Consider starring the repository! ⭐


Start building smarter projects with 10xAnswers today! 🚀

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 56

Collected releases
VersionPublishedDirect dependenciesOpen version
1.0.352 Dec 202431
1.0.341 Dec 202431
1.0.331 Dec 202431
1.0.321 Dec 202431
1.0.311 Dec 202431
1.0.301 Dec 202431
1.0.291 Dec 202431
1.0.281 Dec 202431
1.0.271 Dec 202431
1.0.261 Dec 202431
1.0.251 Dec 202431
1.0.241 Dec 202431
1.0.231 Dec 202431
1.0.221 Dec 202431
1.0.211 Dec 202431
1.0.201 Dec 202431
1.0.191 Dec 202431
1.0.181 Dec 202431
1.0.171 Dec 202431
1.0.161 Dec 202431

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
rajveeerr/10xanswers

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 18:02 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:9a968c46755dbdd696a51c705fa5b8c16e4583608a09fd89a8645919876fd18d