Activity Feed
Real-time activity feed with streaming support.
Preview
A
Ada commented on PR #4122m ago
G
Grace merged main1h ago
Arguments
activity_feed(events=[{'user': 'Ada', 'action': 'commented on', 'target': 'PR #412', 'time': '2m ago'}, {'user': 'Grace', 'action': 'merged', 'target': 'main', 'time': '1h ago'}])Usage
views.py
python
from djust import LiveView
from djust.components import ActivityFeed
class MyView(LiveView):
template_name = "my_template.html"
def mount(self, request, **kwargs):
self.component = ActivityFeed(events=[{'user': 'Ada', 'action': 'commented on', 'target': 'PR #412', 'time': '2m ago'}, {'user': 'Grace', 'action': 'merged', 'target': 'main', 'time': '1h ago'}])my_template.html
django
{{ component }}Needs a client hook djust does not ship: dj-hook="ActivityFeed". The markup renders, but the interaction described above is yours to add — register window.djust.hooks.ActivityFeed = { mounted() { … } } before client.js loads (see the hooks guide).
Parameters
| Name | Type | Default |
|---|---|---|
| events | List[dict] | None | None |
| stream_event | str — the event your server pushes to it | '' |
| max_items | int | 50 |
| 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.activity_feed | 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 2254, 2255, 2257, 2259, 2260, 2261, 2262, 2263, 2264. Override those rules, or the custom properties they read, in a stylesheet loaded after it. |