Chat Bubble
Single chat message bubble with sender avatar, timestamp, and delivery status.
Preview
AL
Ada Lovelace10:04 AM
The deployment is ready for review.
Arguments
chat_bubble(message={'sender': 'user', 'name': 'Ada Lovelace', 'text': 'The deployment is ready for review.', 'time': '10:04 AM', 'status': 'delivered'})Usage
views.py
python
from djust import LiveView
from djust.components import ChatBubble
class MyView(LiveView):
template_name = "my_template.html"
def mount(self, request, **kwargs):
self.component = ChatBubble(message={'sender': 'user', 'name': 'Ada Lovelace', 'text': 'The deployment is ready for review.', 'time': '10:04 AM', 'status': 'delivered'})my_template.html
django
{{ component }}Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| message | Dict | None | None | Dict with keys: sender, name, text, time, avatar (optional), status (optional). sender="user" renders right-aligned; anything else renders left-aligned. status can be: "sending", "sent", "delivered", "read", "error". |
| custom_class | str | '' | Additional CSS classes. |
| **kwargs | — passed to `Component.__init__`: `name=` identifies the instance in the events it sends, `id=` sets `component.id`, and any other keyword is kept as state | — | — |
Source & styles
| File | Path | Notes |
|---|---|---|
| module | djust.components.components.chat_bubble | Subclass it, or pass custom_class, to change how it renders. |
| css | djust_components/components.css | Defines 11 of this component's classes at line 1712, 1713, 1715, 1717, 1718, 1721, 1722, 1723, 1724, 1725, 1726. Override those rules, or the custom properties they read, in a stylesheet loaded after it. |
| css | djust_components/components-classes.css | Defines 10 of this component's classes at line 765, 766, 768, 770, 771, 772, 773, 774, 775, 776. Override those rules, or the custom properties they read, in a stylesheet loaded after it. |