Avatar Group
Style-agnostic avatar group using CSS custom properties.
Preview
ALGH+1
Arguments
avatar_group(users=[{'name': 'Ada Lovelace'}, {'name': 'Grace Hopper'}, {'name': 'Alan Turing'}], max_display=2)Usage
views.py
python
from djust import LiveView
from djust.components import AvatarGroup
class MyView(LiveView):
template_name = "my_template.html"
def mount(self, request, **kwargs):
self.component = AvatarGroup(users=[{'name': 'Ada Lovelace'}, {'name': 'Grace Hopper'}, {'name': 'Alan Turing'}], max_display=2)my_template.html
django
{{ component }}Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| users | List[Union[dict, object]] | None | None | List of user dicts (name, avatar/src) or objects with get_full_name() and optional avatar attribute. |
| max_display | int | 5 | Maximum avatars shown before "+N" overflow (default: 5). |
| size | str | 'md' | Size variant (sm, md, lg). |
| 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.avatar_group | Subclass it, or pass custom_class, to change how it renders. |
| css | djust_components/components-classes.css | Defines 5 of this component's classes at line 643, 644, 647, 648, 650. Override those rules, or the custom properties they read, in a stylesheet loaded after it. |
| css | djust_components/components.css | Defines 5 of this component's classes at line 1615, 1616, 1619, 1620, 1623. Override those rules, or the custom properties they read, in a stylesheet loaded after it. |