Kanban Board

Kanban board component.

python 5 params

Preview

To do
Write docs
In progress
Fix crash
Done
Arguments
kanban_board(columns=[{'id': 'todo', 'title': 'To do', 'cards': [{'id': 'c1', 'title': 'Write docs'}]}, {'id': 'doing', 'title': 'In progress', 'cards': [{'id': 'c2', 'title': 'Fix crash'}]}, {'id': 'done', 'title': 'Done', 'cards': []}])

Usage

views.py
python
from djust import LiveView
from djust.decorators import event_handler
from djust.components import KanbanBoard


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

    def mount(self, request, **kwargs):
        self.component = KanbanBoard(columns=[{'id': 'todo', 'title': 'To do', 'cards': [{'id': 'c1', 'title': 'Write docs'}]}, {'id': 'doing', 'title': 'In progress', 'cards': [{'id': 'c2', 'title': 'Fix crash'}]}, {'id': 'done', 'title': 'Done', 'cards': []}])

    @event_handler()
    def kanban_add_card(self, **kwargs):
        self.component.columns = ...  # `add_card` — see this component's docs

    @event_handler()
    def kanban_move(self, **kwargs):
        ...  # write to self.component; the re-render carries it
my_template.html
django
{{ component }}

Events this component sends to the view: kanban_add_card, kanban_move.

Parameters

NameTypeDefault
columnslist | NoneNone
move_eventstr — renames the event; identity is `name`'kanban_move'
add_card_eventstr — renames the event; identity is `name`'kanban_add_card'
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.kanban_boardSubclass it, or pass custom_class, to change how it renders.
cssdjust_components/components.cssDefines 8 of this component's classes at line 882, 883, 885, 886, 888, 889, 892, 898. Override those rules, or the custom properties they read, in a stylesheet loaded after it.