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

NameTypeDefault
itemsList[dict] | NoneNone
columnsint3
filter_keystr'category'
eventstr — renames the event; identity is `name`''
custom_classstr''
**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 2365, 2366, 2367, 2369, 2370, 2371, 2374, 2375, 2376. Override those rules, or the custom properties they read, in a stylesheet loaded after it.