Form Group
Form group wrapper component.
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
| Name | Type | Default | Description |
|---|---|---|---|
| content | str | '' | form field content (pre-rendered HTML) |
| label | str | '' | label text |
| error | str | '' | error message |
| helper | str | '' | helper text |
| required | bool | False | whether field is required |
| for_input | str | '' | id of the associated input |
| custom_class | str | '' | — |
| **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
| File | Path | Notes |
|---|---|---|
| module | djust.components.components.form_group | Subclass it, or pass custom_class, to change how it renders. |
| css | djust_components/components.css | Defines 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. |
| css | djust_theming/components.css | Defines 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. |
| css | djust_theming/scaffold.css | Defines 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. |