gpui-kit GitHub

Components

Drawer view

A panel anchored to one side of the window.

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

use gpui_kit::overlay::Drawer;

Construct

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

Options

Chain onto the value.

edge(edge: Edge) -> Self
size(size: f32) -> Self
title(title: impl Into<SharedString>) -> Self
description(description: impl Into<SharedString>) -> Self
content(body: impl Fn(&mut Window, &mut App) -> AnyElement + 'static) -> Self
footer(footer: impl Fn(&mut Window, &mut App) -> AnyElement + 'static) -> Self
dismissable(dismissable: bool) -> Self
focus_stops(stops: impl IntoIterator<Item = FocusHandle>) -> Self

Commands

Need a Context, so they need a view.

set_focus_stops(stops: impl IntoIterator<Item = FocusHandle>, cx: &mut Context<Self>)
set_title(title: impl Into<SharedString>, cx: &mut Context<Self>)
open(window: &mut Window, cx: &mut Context<Self>)
close(_window: &mut Window, cx: &mut Context<Self>)
dismiss(window: &mut Window, cx: &mut Context<Self>)
settle(cx: &mut Context<Self>)

Queries

Only answer; they change nothing.

is_open() -> bool
is_dismissable() -> bool
is_rendered() -> 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/overlay/drawer.rs