Meter
Style-agnostic meter / stacked progress component.
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
| Name | Type | Default |
|---|---|---|
| segments | list | None | None |
| total | int | 100 |
| label | str | '' |
| show_legend | bool | True |
| 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.meter | Subclass it, or pass custom_class, to change how it renders. |
| css | djust_components/components.css | Defines 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. |