Cursors Overlay
Overlay showing other users' cursor positions in real-time.
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
| Name | Type | Default | Description |
|---|---|---|---|
| users | List[Union[dict, object]] | None | None | List of user dicts with name, color, x, y. |
| custom_class | str | '' | 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
| File | Path | Notes |
|---|---|---|
| module | djust.components.components.cursors_overlay | Subclass it, or pass custom_class, to change how it renders. |
| css | djust_components/components.css | Defines 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. |