Activity Feed

Real-time activity feed with streaming support.

python 5 params

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 its script on the page: <script src="{% static 'djust_components/activity-feed.js' %}"></script>. djust ships it; without it the markup renders but does not update in the browser.

Parameters

NameTypeDefaultDescription
eventsList[dict] | NoneNoneList of event dicts with user, action, target, time, avatar.
stream_eventstr — the event your server pushes to it''WebSocket event name for live updates.
max_itemsint50Maximum number of visible items (default: 50).
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.activity_feedSubclass it, or pass custom_class, to change how it renders.
cssdjust_components/components.cssDefines 9 of this component's classes at line 2322, 2323, 2325, 2327, 2328, 2329, 2330, 2331, 2332. Override those rules, or the custom properties they read, in a stylesheet loaded after it.