gpui-kit GitHub

Components

Calendar view

A month of days.

A view survives a frame. Hold it in an Entity with cx.new(..) and reach it with .update(..).

use gpui_kit::datetime::Calendar;

Construct

new(ident: impl Into<Ident>, adapter: SharedDateAdapter, _window: &mut Window, cx: &mut Context<Self>) -> Self

Options

Chain onto the value.

selected(days: impl IntoIterator<Item = Day>) -> Self
multi(multi: bool) -> Self
month(month: MonthKey) -> Self
overlay(overlay: impl Fn(Day) -> Option<DayMark> + 'static) -> Self
range(range: DayRange) -> Self

Commands

Need a Context, so they need a view.

set_selection(days: Vec<Day>, cx: &mut Context<Self>)
set_overlay(overlay: impl Fn(Day) -> Option<DayMark> + 'static, cx: &mut Context<Self>)
set_range(range: Option<DayRange>, cx: &mut Context<Self>)
set_disabled(disabled: bool, cx: &mut Context<Self>)
set_hovered_day(day: Option<Day>, cx: &mut Context<Self>)
shift(delta: i32, cx: &mut Context<Self>)
show_month(month: MonthKey, cx: &mut Context<Self>)

Queries

Only answer; they change nothing.

adapter() -> &SharedDateAdapter
selection() -> &[Day]
cursor() -> Option<Day>
hovered_day() -> Option<Day>
shown_month() -> Option<MonthKey>

Reports

The variants of the event it emits. It never applies the change itself.

Rendered by

Each of these compiles and is captured by the gate, so the code behind them is verified rather than written.

Source: crates/gpui-kit/src/datetime/calendar.rs