GPUI Box GitHub

Components / data

KanbanBoard builder

A board of host-owned columns and cards.

A builder is RenderOnce. Construct and mount it in one expression.

use gpui_kit::data::KanbanBoard;

Reviewed in kanban.

Construct
new(ident: impl Into<Ident>) -> Self
Options

Chain onto the value.

held(card: impl Into<SharedString>) -> Self
columns(columns: impl IntoIterator<Item = KanbanColumn>) -> Self
cards(cards: impl IntoIterator<Item = KanbanCard>) -> Self
state(state: KanbanState) -> Self
on_card(handler: impl Fn(&KanbanCard, &mut Window, &mut App) + 'static) -> Self
on_move(handler: impl Fn(&KanbanCard, SharedString, &mut Window, &mut App) + 'static) -> Self
on_add(handler: impl Fn(SharedString, &mut Window, &mut App) + 'static) -> Self
Example · kanban
fn kanban(_window: &mut Window, cx: &mut App) -> AnyElement {
    let theme = cx.theme().clone();
    stack(&theme)
        .w(px(640.0))
        .child(caption(
            &theme,
            "columns and cards are host-owned; a held card can report a move",
        ))
        .child(
            KanbanBoard::new("scene.kanban.ready")
                .columns([
                    KanbanColumn::new("inbox", "Inbox"),
                    KanbanColumn::new("doing", "Doing").limit(2),
                    KanbanColumn::new("done", "Done"),
                ])
                .cards([
                    KanbanCard::new("triage", "Triage fixture", "inbox")
                        .detail("Waiting on review"),
                    KanbanCard::new("draw", "Draw scene", "doing"),
                    KanbanCard::new("caption", "Write captions", "doing"),
                    KanbanCard::new("audit", "Audit tokens", "doing"),
                    KanbanCard::new("ship", "Ship notes", "done"),
                ])
                .held("triage")
                .on_card(|_, _, _| {})
                .on_move(|_, _, _, _| {})
                .on_add(|_, _, _| {}),
        )
        .child(KanbanBoard::new("scene.kanban.loading").state(KanbanState::Loading))
        .child(KanbanBoard::new("scene.kanban.empty").state(KanbanState::Empty))
        .child(
            KanbanBoard::new("scene.kanban.unavailable").state(KanbanState::Unavailable(
                "The board host refused the request.".into(),
            )),
        )
        .child(
            KanbanBoard::new("scene.kanban.error")
                .state(KanbanState::Error("The board request failed.".into())),
        )
        .into_any_element()
}

Source: crates/gpui-kit/src/data/kanban.rs