Avatar Group

Style-agnostic avatar group using CSS custom properties.

python 5 params

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

NameTypeDefaultDescription
usersList[Union[dict, object]] | NoneNoneList of user dicts (name, avatar/src) or objects with get_full_name() and optional avatar attribute.
max_displayint5Maximum avatars shown before "+N" overflow (default: 5).
sizestr'md'Size variant (sm, md, lg).
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.avatar_groupSubclass it, or pass custom_class, to change how it renders.
cssdjust_components/components-classes.cssDefines 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.
cssdjust_components/components.cssDefines 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.