Kanban Board
Kanban board component.
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 itmy_template.html
django
{{ component }}Events this component sends to the view: kanban_add_card, kanban_move.
Parameters
| Name | Type | Default |
|---|---|---|
| columns | list | None | None |
| move_event | str — renames the event; identity is `name` | 'kanban_move' |
| add_card_event | str — renames the event; identity is `name` | 'kanban_add_card' |
| custom_class | str | '' |
| **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
| File | Path | Notes |
|---|---|---|
| module | djust.components.components.kanban_board | Subclass it, or pass custom_class, to change how it renders. |
| css | djust_components/components.css | Defines 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. |