Data Card Grid

Filterable card grid layout.

python 6 params

Preview

Alpha

First example project.

Beta

Second example project.

Gamma

Third example project.

Arguments
data_card_grid(columns=3, items=[{'title': 'Alpha', 'description': 'First example project.', 'category': 'Web'}, {'title': 'Beta', 'description': 'Second example project.', 'category': 'Web'}, {'title': 'Gamma', 'description': 'Third example project.', 'category': 'CLI'}])

Usage

views.py
python
from djust import LiveView
from djust.components import DataCardGrid


class MyView(LiveView):
    template_name = "my_template.html"

    def mount(self, request, **kwargs):
        self.component = DataCardGrid(columns=3, items=[{'title': 'Alpha', 'description': 'First example project.', 'category': 'Web'}, {'title': 'Beta', 'description': 'Second example project.', 'category': 'Web'}, {'title': 'Gamma', 'description': 'Third example project.', 'category': 'CLI'}])
my_template.html
django
{{ component }}

Parameters

NameTypeDefaultDescription
itemsList[dict] | NoneNoneList of item dicts with title, description, category, image, url.
columnsint3Number of columns (default: 3).
filter_keystr'category'Key in items used for filtering (default: "category").
eventstr — renames the event; identity is `name`''Event fired on card click.
custom_classstr''Additional CSS classes.
**kwargs— passed to `Component.__init__`: `name=` identifies the instance in the events it sends, `id=` sets `component.id`, and any other keyword is kept as state——
Source & styles
FilePathNotes
moduledjust.components.components.data_card_gridSubclass it, or pass custom_class, to change how it renders.
cssdjust_components/components.cssDefines 9 of this component's classes at line 2467, 2468, 2469, 2471, 2473, 2474, 2477, 2478, 2479. Override those rules, or the custom properties they read, in a stylesheet loaded after it.