CardsInput
Card selection input widget for choosing from visual card options.
Examples
Basic Usage
This example runs a form with a single page containing the widget
Example Code
Searchable
You may also add a search bar to the cards input widget.
Example Code
Parameters
| Name | Description | Type | Default |
|---|---|---|---|
| label (required) | Text label displayed above the cards. | str | None |
| options (required) | List of card options to display. CardOption is a Dict with the following structure: TypedDict(\{"title": str, "subtitle": str, "image": str, "description": str, "topLeftExtra": str, "topRightExtra": str\}) | List[CardOption] | None |
| key | Identifier for the widget, defaults to label if not provided. | str | None |
| required | Whether a card selection is required before proceeding. | bool | True |
| searchable | Whether cards can be filtered by search. | bool | False |
| multiple | Whether multiple cards can be selected. | bool | False |
| hint | Help text displayed below the input. | str | None |
| columns | Number of columns to display cards in. | int | 2 |
| full_width | Whether the cards should take up the full width of their container. | bool | False |
| layout | Layout style for the cards ('list' or 'grid'). | str | 'list' |
| disabled | Whether the input is non-interactive. | bool | False |
| min | Minimum number of cards that must be selected when multiple=True. | int | None |
| max | Maximum number of cards that can be selected when multiple=True. | int | None |
| errors | Pre-defined validation error messages to display. | Union[List[str], str] | None |
State Value
Union[List[CardOption], CardOption, None]: The selected card option(s). CardOption is a Dict with the following structure: {"title": str, "subtitle": str, "image": str, "description": str, "topLeftExtra": str, "topRightExtra": str}
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