1.0.0 • Published 11 months ago

@qomponent/qui-bubble v1.0.0

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
11 months ago

qui-bubble

qui-bubble is a lightweight, customizable Web Component for rendering chat bubbles in a conversation-style UI. It supports text messages, rich content, avatars, typing indicators, and CSS customizations.


🌟 Features

āœ… Web Component – Works in any frontend framework or vanilla HTML
āœ… Customizable with CSS Variables – Easily style bubbles, colors, and spacing
āœ… Supports Named Messages – Display sender names with icons
āœ… Slot Support – Embed rich content like images or formatted text
āœ… Typing Indicator – Animated dots for real-time conversations


šŸ“¦ Installation

Install via npm:

npm i @qomponent/qui-bubble

šŸš€ Usage

1. Import the Component

ES Module

import '@qomponent/qui-bubble';

HTML (No Build Setup Required)

<script type="module" src="https://cdn.jsdelivr.net/npm/@qomponent/qui-bubble"></script>

2. Add Chat Bubbles

<div class="chat-container">

    <qui-bubble message="Hello! How are you?" side="left" name="Alice"
        icon="https://randomuser.me/api/portraits/women/1.jpg">
    </qui-bubble>

    <qui-bubble message="I'm good! How about you?" side="right"></qui-bubble>

    <qui-bubble side="right">
        <span style="color: blue; font-weight: bold;">Custom <i>styled</i> message!</span>
    </qui-bubble>

    <qui-bubble side="left" name="Kristen">
        <img src="https://randomuser.me/api/portraits/women/2.jpg"><span>My new profile pic</span>
    </qui-bubble>

    <qui-bubble side="left" name="Bob" typing></qui-bubble>
</div>

šŸŽØ Customization

You can customize the chat bubbles using CSS variables:

chat-bubble {
  --chat-bubble-bg: #007aff;
  --chat-bubble-color: white;
  --chat-bubble-border-radius: 20px;
  --chat-bubble-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
  --chat-bubble-typing-dot: #ff5722;
}

Available CSS Variables

VariableDefault ValueDescription
--chat-bubble-bglightgrayBackground color of the bubble
--chat-bubble-colorblackText color inside the bubble
--chat-bubble-border-radius12pxCorner radius of the bubble
--chat-bubble-padding8px 12pxInner padding of the bubble
--chat-bubble-shadow0px 4px 8px rgba(0, 0, 0, 0.1)Shadow effect
--chat-bubble-typing-dot#666Color of typing indicator dots

šŸ”„ Example (Run Locally)

To run the example locally:

npm install
npm start

This will start a local development server with a demo page.


šŸ¤ Contributing

Pull requests are welcome! šŸš€
For major changes, please open an issue first to discuss your ideas.


šŸ“œ License

This project is licensed under the Apache 2.0 License.
Read the full license.

1.0.0

11 months ago