Cursors Overlay

Overlay showing other users' cursor positions in real-time.

python 3 params

Preview

Ada Lovelace
Grace Hopper
Arguments
cursors_overlay(users=[{'name': 'Ada Lovelace', 'color': '#3b82f6', 'x': 120, 'y': 40}, {'name': 'Grace Hopper', 'color': '#ef4444', 'x': 260, 'y': 120}])

Usage

views.py
python
from djust import LiveView
from djust.components import CursorsOverlay


class MyView(LiveView):
    template_name = "my_template.html"

    def mount(self, request, **kwargs):
        self.component = CursorsOverlay(users=[{'name': 'Ada Lovelace', 'color': '#3b82f6', 'x': 120, 'y': 40}, {'name': 'Grace Hopper', 'color': '#ef4444', 'x': 260, 'y': 120}])
my_template.html
django
{{ component }}

Needs its script on the page: <script src="{% static 'djust_components/cursors-overlay.js' %}"></script>. djust ships it; without it the markup renders but does not update in the browser.

Parameters

NameTypeDefaultDescription
usersList[Union[dict, object]] | NoneNoneList of user dicts with name, color, x, y.
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.cursors_overlaySubclass it, or pass custom_class, to change how it renders.
cssdjust_components/components.cssDefines 4 of this component's classes at line 2287, 2288, 2289, 2290. Override those rules, or the custom properties they read, in a stylesheet loaded after it.