Notification Badge

Style-agnostic notification badge using CSS custom properties.

python 7 params

Preview

5
Arguments
notification_badge(count=5)
99
Arguments
notification_badge(count=99)
Arguments
notification_badge(count=0)

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

NameTypeDefault
countint0
max_countint99
dotboolFalse
pulseboolFalse
sizestr'md'
custom_classstr''
**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.cssDefines 2 of this component's classes at line 2508, 2510. Override those rules, or the custom properties they read, in a stylesheet loaded after it.
cssdjust_components/components-classes.cssDefines 1 of this component's classes at line 361. Override those rules, or the custom properties they read, in a stylesheet loaded after it.