subspace-dashboard 0.1.0

Subspace Framework board kit: the Dashboard trait, shared widgets and design tokens. Internal crate; apps depend on `subspace-framework`.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//! A surface anchored where it is laid out, such as a card under a focused
//! reference: drawn above its neighbours and kept inside the window.

use gpui_kit::{AnyElement, IntoElement, ParentElement as _, anchored, deferred, px};

/// Keeps a floating surface off the window's edge.
const MARGIN_PX: f32 = 8.;

/// `content` floating at its layout position, above what is drawn later.
// qual:api
pub fn floating(content: impl IntoElement) -> AnyElement {
    let placed = anchored()
        .snap_to_window_with_margin(px(MARGIN_PX))
        .child(content);
    deferred(placed).with_priority(1).into_any_element()
}