Notification Badge

Style-agnostic notification badge using CSS custom properties.

python 7 params

Preview

dot
pulse
5
python
notification_badge(count=5)
More examples
99
Arguments
notification_badge(count=99)
Arguments
notification_badge(dot=True, pulse=True)

Usage

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


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

    def mount(self, request, **kwargs):
        self.component = NotificationBadge(count=5)
my_template.html
django
{{ component }}

Parameters

NameTypeDefaultDescription
countint0Number to display
max_countint99Maximum count before showing "N+" (default: 99)
dotboolFalseShow as a dot with no text (default: False)
pulseboolFalseAnimate with pulse (default: False)
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.notification_badgeSubclass it, or pass custom_class, to change how it renders.
cssdjust_components/components-classes.cssDefines 3 of this component's classes at line 363, 393, 412. Override those rules, or the custom properties they read, in a stylesheet loaded after it.
cssdjust_components/components.cssDefines 2 of this component's classes at line 2611, 2613. Override those rules, or the custom properties they read, in a stylesheet loaded after it.