checkbox
Displays a checkbox input widget and maps its value to the backend as a boolean.
Basic use¶
{% htmx_checkbox name="my_input" %}
from simmate.website.htmx.components import HtmxComponent
class ExampleView(HtmxComponent):
my_input = "some default value"
Parameters¶
| Parameter | Description |
|---|---|
name |
The unique name or identifier for the input field. This should match the name of your class attribute in the backend. Type: str, Default: — |
label |
The display label for the input field. If not provided, the name may be used as the label.Type: str, Default: None |
show_label |
Whether to display the label alongside the input field. Type: bool, Default: True |
help_text |
Optional helper text to be shown alongside the input field. Type: str, Default: None |
side_text |
Text displayed to the right of the checkbox. Type: str, Default: Yes/True |
defer |
Whether to defer processing or submission of the input value. Type: bool, Default: True |
required |
Whether the field is required for form submission. Type: bool, Default: False |
switch_mode |
Whether to display the checkbox as a toggle switch. Type: bool, Default: True |