Skip to main content

ChecklistInput

Checklist input widget for selecting multiple options from a list.

Examples

Basic Usage

This example runs a form with a single page containing the widget

Example Code

from abstra.forms import ChecklistInput, run

# Create a page with the widget
example_page = [
ChecklistInput(
label="Checklist Input",
key="my-checklist_input",
options=["Option A", "Option B", "Option C"],
),
]

# Run the form
result = run([example_page])

# Print the result
print(result)

Parameters

NameDescriptionTypeDefault
label (required)Text label displayed above the checklist.strNone
options (required)List of options to choose from, either as {"label": str, "value": str} dictionaries or simple strings.Union[List[LabelValueDict], List[str]]None
keyIdentifier for the widget, defaults to label if not provided.strNone
requiredWhether at least one option must be selected before proceeding.boolTrue
hintHelp text displayed below the checklist.strNone
full_widthWhether the checklist should take up the full width of its container.boolFalse
disabledWhether the checklist is non-interactive.boolFalse
minMinimum number of options that must be selected.int0
maxMaximum number of options that can be selected.intNone
errorsPre-defined validation error messages to display.List[str]None

State Value

List[object]: The list of selected values.

info

This is the type of the value that this widget holds. It will show up when accessing widget's state item.

This also defines which value type can be used on initial_state