Card View

Card-based view components for the UI Generator framework.

This module provides the CardView class, which enables displaying data in a visually appealing card-style layout. Card views are ideal for presenting structured information in a grid of individual cards, each representing a single data record or item.

Classes:
  • CardView: View for displaying data in a card-based layout

Example

>>> # Define the data source
>>> products_table = Table("products")
>>>
>>> # Create a card template
>>> product_card = Card(
...     title_field=Field("product_name", DataType.STRING),
...     subtitle_field=Field("category", DataType.STRING),
...     image_field=Field("image_url", DataType.STRING),
...     description_field=Field("description", DataType.STRING)
... )
>>>
>>> # Create and register the card view
>>> builder = UiBuilder()
>>> card_view = builder.add_card_view(
...     card_template=product_card,
...     table=products_table,
...     display_name="Product Catalog"
... )
>>>
class CardView(card_template, display_name=None, hidden=False)[source]

Bases: BaseView, FilterableView

Represents a card-based view used to display data in a structured, card-style layout. A CardView defines which data source it draws from, how rows are filtered, and which card template is used to render each item.

card_template

The card template used to render each row/item in the view.

Type:

Card

source_table

The ID of the source table providing the data for the view.

Type:

Optional[str]

match_row_filter_mode

Controls how rows are included or excluded based on filtering rules.

Type:

Optional[MatchRowFilterMode]

__init__(card_template, display_name=None, hidden=False)[source]
Parameters:
  • card_template (Card) – The card template used to render each row.

  • display_name (str | None) – Optional display name for this view.

  • hidden (bool) – If True, the view is not visible in the UI.

set_table(table)[source]

Sets the source data table for this card view.

Return type:

CardView

set_match_row_filter_mode(match_row_filter_mode)[source]

Sets the row filter mode controlling how rows are included or excluded.

Return type:

CardView

set_use_filter(use_filter)[source]

Attaches a filter component to this card view.

Return type:

CardView