Skip to content

search_box

Displays a search box widget that combines a selectbox (optional), a single-line text input, and a button. Useful for search/filter interfaces.

Basic use

{% search_box name="search_query" %}
from simmate.website.core_components.components import DynamicFormComponent

class ExampleView(DynamicFormComponent):
    search_query = ""

Parameters

Parameter Description
name The unique name or identifier for the text input field. Should match the backend attribute.
Type: str, Default: —
label The display label for the input. If not provided, a label is auto-generated from name.
Type: str, Default: None
show_label Whether to display the label alongside the input field.
Type: bool, Default: True
help_text Optional helper text shown alongside the input.
Type: str, Default: None
disabled If True, disables the input field.
Type: bool, Default: False

For the text input:

Parameter Description
placeholder Placeholder text for the input field.
Type: str, Default: "Type value..."
max_length Maximum number of characters allowed in the input.
Type: int, Default: None

For the selectbox:

Parameter Description
show_selectbox Whether to include a dropdown selectbox before the input.
Type: bool, Default: False
selectbox_name Name/id for the selectbox. If not provided, auto-generated as {name}_type.
Type: str, Default: f"{name}_type"
selectbox_options The name of the class attribute that holds all options for the selectbox. In python, options should be a list of ('label', 'value'), where label is what's shown in the UI and value is what is set in python.
*Type: str, Default: f"{selectbox_name}_options"

For the button:

Parameter Description
button_name The name/id for the button. If not provided, auto-generated as set_{name}.
Type: str, Default: None
button_theme Visual theme for the button (e.g., "primary").
Type: str, Default: "primary"
button_icon Icon name for the button.
Type: str, Default: "magnify"