Form Group

Form group wrapper component.

python 8 params

Preview

We never share it.
Arguments
form_group(label='Email', content='<input type="email" placeholder="you@example.com">', helper='We never share it.')

Usage

views.py
python
from djust import LiveView
from djust.components import FormGroup
from django.utils.safestring import mark_safe


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

    def mount(self, request, **kwargs):
        self.component = FormGroup(label='Email', content=mark_safe('<input type="email" placeholder="you@example.com">'), helper='We never share it.')
my_template.html
django
{{ component }}

Parameters

NameTypeDefaultDescription
contentstr''form field content (pre-rendered HTML)
labelstr''label text
errorstr''error message
helperstr''helper text
requiredboolFalsewhether field is required
for_inputstr''id of the associated input
custom_classstr''—
**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
FilePathNotes
moduledjust.components.components.form_groupSubclass it, or pass custom_class, to change how it renders.
cssdjust_components/components.cssDefines 3 of this component's classes at line 523, 525, 527. Override those rules, or the custom properties they read, in a stylesheet loaded after it.
cssdjust_theming/components.cssDefines 2 of this component's classes at line 1114, 1453. Override those rules, or the custom properties they read, in a stylesheet loaded after it.
cssdjust_theming/scaffold.cssDefines 2 of this component's classes at line 438, 445. Override those rules, or the custom properties they read, in a stylesheet loaded after it.