Currency Input

Numeric input with currency symbol prefix and formatting hints.

python 14 params

Preview

$USD

Usage

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


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

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

Parameters

NameTypeDefaultDescription
namestr''Form field name.
currencystr'USD'Currency code (USD, EUR, GBP, etc.).
valuestr''Current numeric value.
labelstr''Optional label text.
minfloat | NoneNoneMinimum value.
maxfloat | NoneNoneMaximum value.
stepstr'0.01'Step increment (default 0.01).
placeholderstr'0.00'Placeholder text.
eventstr — renames the event''dj-input event name.
disabledboolFalseWhether the input is disabled.
requiredboolFalseWhether the field is required.
errorstr''Error message to display.
custom_classstr''Additional CSS classes.
**kwargs— passed to `Component.__init__`: `id=` sets `component.id`, and any other keyword is kept as state——
Source & styles
FilePathNotes
moduledjust.components.components.currency_inputSubclass it, or pass custom_class, to change how it renders.
cssdjust_components/components.cssDefines 5 of this component's classes at line 1453, 1454, 1456, 1457, 1461. Override those rules, or the custom properties they read, in a stylesheet loaded after it.