Skip to main content

component_select_list

ComponentSelectList

from dara.components.common.component_select_list import ComponentSelectList

class ComponentSelectList(LayoutComponent)

ComponentSelectList

The ComponentSelectList Component shows a container which contains cards that can be selected by an user.

A ComponentSelectList can be created via:

from dara.core import Variable
from dara.components import (
ComponentSelectList,
ComponentItem,
Text,
)

ComponentSelectList(
items=[
ComponentItem(title='TitleA', subtitle='subtitle', component=Text('A')),
ComponentItem(title='TitleB', subtitle='subtitle', component=Text('B')),
ComponentItem(title='TitleC', subtitle='subtitle', component=Text('C')),
],
selected_items=Variable('TitleB'),
)

:param items: The items to display, each should have a title, subtitle and component to display :param items_per_row: An optional param to specify the number of items per row, 3 by default :param multi_select: An optional flag for allowing selecting multiple cards, False by default :param on_select: An optional Action for listening to changes in the selected items :param selected_items: The initial selected items, can be an list if multiSelect is true otherwise a string. This takes the titles of the items as value.

Attributes

  • items: List[ComponentItem]
  • items_per_row: Optional[int]
  • multi_select: Optional[bool]
  • on_select: Optional[Action]
  • selected_items: Optional[Variable[Union[str, List[str]]]]