Meter

Style-agnostic meter / stacked progress component.

python 6 params

Preview

Storage
Used70
Arguments
meter(segments=[{'value': 70, 'label': 'Used'}], total=100, label='Storage')
Memory
Used30
Arguments
meter(segments=[{'value': 30, 'label': 'Used'}], total=100, label='Memory')

Usage

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


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

    def mount(self, request, **kwargs):
        self.component = Meter(segments=[{'value': 70, 'label': 'Used'}], total=100, label='Storage')
my_template.html
django
{{ component }}

Parameters

NameTypeDefault
segmentslist | NoneNone
totalint100
labelstr''
show_legendboolTrue
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.meterSubclass it, or pass custom_class, to change how it renders.
cssdjust_components/components.cssDefines 9 of this component's classes at line 1870, 1871, 1872, 1877, 1878, 1879, 1880, 1881, 1882. Override those rules, or the custom properties they read, in a stylesheet loaded after it.