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 |
|---|---|---|
| users | List[Union[dict, object]] | None | None |
| max_display | int | 5 |
| size | str | 'md' |
| 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.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 641, 642, 645, 646, 648. 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 1589, 1590, 1593, 1594, 1597. Override those rules, or the custom properties they read, in a stylesheet loaded after it. |