Dependent Select
Cascading dropdown that reloads options when a parent field changes.
Preview
Usage
views.py
python
from djust import LiveView
from djust.components import DependentSelect
class MyView(LiveView):
template_name = "my_template.html"
def mount(self, request, **kwargs):
self.component = DependentSelect()my_template.html
django
{{ component }}Parameters
| Name | Type | Default |
|---|---|---|
| name | str | '' |
| parent | str | '' |
| source_event | str — renames the event | '' |
| label | str | '' |
| placeholder | str | 'Select...' |
| value | str | '' |
| options | list | None | None |
| loading | bool | False |
| disabled | bool | False |
| required | bool | False |
| error | str | '' |
| custom_class | str | '' |
| **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.dependent_select | Subclass it, or pass custom_class, to change how it renders. |
| css | djust_components/components.css | Defines 2 of this component's classes at line 1414, 1415. Override those rules, or the custom properties they read, in a stylesheet loaded after it. |