Dependent Select

Cascading dropdown that reloads options when a parent field changes.

python 13 params

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

NameTypeDefault
namestr''
parentstr''
source_eventstr — renames the event''
labelstr''
placeholderstr'Select...'
valuestr''
optionslist | NoneNone
loadingboolFalse
disabledboolFalse
requiredboolFalse
errorstr''
custom_classstr''
**kwargs— passed to `Component.__init__`: `id=` sets `component.id`, and any other keyword is kept as state
Source & styles
FilePathNotes
moduledjust.components.components.dependent_selectSubclass it, or pass custom_class, to change how it renders.
cssdjust_components/components.cssDefines 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.