Conversation Thread
Chat-style message thread with sender avatars, timestamps, and grouping.
Preview
Y
You10:04
Summarise this thread.
A
Assistant10:04
Three points so far.
Arguments
conversation_thread(messages=[{'sender': 'user', 'name': 'You', 'text': 'Summarise this thread.', 'time': '10:04'}, {'sender': 'assistant', 'name': 'Assistant', 'text': 'Three points so far.', 'time': '10:04'}])Usage
views.py
python
from djust import LiveView
from djust.components import ConversationThread
class MyView(LiveView):
template_name = "my_template.html"
def mount(self, request, **kwargs):
self.component = ConversationThread(messages=[{'sender': 'user', 'name': 'You', 'text': 'Summarise this thread.', 'time': '10:04'}, {'sender': 'assistant', 'name': 'Assistant', 'text': 'Three points so far.', 'time': '10:04'}])my_template.html
django
{{ component }}Parameters
| Name | Type | Default |
|---|---|---|
| messages | List[Dict] | None | None |
| stream_event | str — the event your server pushes to it | 'new_message' |
| streaming | bool | False |
| custom_class | str | '' |
| **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.conversation_thread | Subclass it, or pass custom_class, to change how it renders. |
| css | djust_components/components.css | Defines 9 of this component's classes at line 1636, 1637, 1638, 1641, 1643, 1646, 1647, 1648, 1649. Override those rules, or the custom properties they read, in a stylesheet loaded after it. |
| css | djust_components/components-classes.css | Defines 5 of this component's classes at line 670, 671, 672, 674, 676. Override those rules, or the custom properties they read, in a stylesheet loaded after it. |