Chat Bubble

Single chat message bubble with sender avatar, timestamp, and delivery status.

python 3 params

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

NameTypeDefaultDescription
messageDict | NoneNoneDict 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_classstr''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
FilePathNotes
moduledjust.components.components.chat_bubbleSubclass it, or pass custom_class, to change how it renders.
cssdjust_components/components.cssDefines 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.
cssdjust_components/components-classes.cssDefines 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.