gpui-kit GitHub

Components

DateInput view

A text field over a host-owned calendar, with that calendar in a popover.

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

use gpui_kit::datetime::DateInput;

Construct

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

Options

Chain onto the value.

value(day: Day) -> Self
required(required: bool) -> Self

Commands

Need a Context, so they need a view.

set_value(day: Option<Day>, cx: &mut Context<Self>)
set_disabled(disabled: bool, cx: &mut Context<Self>)
open(cx: &mut Context<Self>)
close(cx: &mut Context<Self>)
toggle(cx: &mut Context<Self>)

Queries

Only answer; they change nothing.

field() -> &Entity<TextInput>
calendar() -> &Entity<Calendar>
current() -> Option<Day>
message() -> Option<&SharedString>
is_open() -> bool
shown_text(cx: &App) -> SharedString
is_invalid() -> bool

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/date_input.rs