Currency Input
Numeric input with currency symbol prefix and formatting hints.
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
| Name | Type | Default | Description |
|---|---|---|---|
| name | str | '' | Form field name. |
| currency | str | 'USD' | Currency code (USD, EUR, GBP, etc.). |
| value | str | '' | Current numeric value. |
| label | str | '' | Optional label text. |
| min | float | None | None | Minimum value. |
| max | float | None | None | Maximum value. |
| step | str | '0.01' | Step increment (default 0.01). |
| placeholder | str | '0.00' | Placeholder text. |
| event | str — renames the event | '' | dj-input event name. |
| disabled | bool | False | Whether the input is disabled. |
| required | bool | False | Whether the field is required. |
| error | str | '' | Error message to display. |
| custom_class | str | '' | Additional CSS classes. |
| **kwargs | — passed to `Component.__init__`: `id=` sets `component.id`, and any other keyword is kept as state | — | — |
Source & styles
| File | Path | Notes |
|---|---|---|
| module | djust.components.components.currency_input | Subclass it, or pass custom_class, to change how it renders. |
| css | djust_components/components.css | Defines 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. |