Slide Panel
An edge-anchored drawer.
Basic use
use xgpui_luma_look_radix as radix;
use gpui::{Context, KeyDownEvent};
use xgpui_luma::controls::slide_panel::{
SlidePanelState, SlidePanelSizeConfig, SlidePanelTopAnchor, SlidePanelOverlayHandlers,
};
struct Example {
state: SlidePanelState,
close_requests: usize,
}
impl Example {
fn new(look: &radix::Look) -> Self {
Self {
state: radix::slide_panel_state(
look,
SlidePanelTopAnchor::WindowEdge,
SlidePanelSizeConfig::new(320.0, 240.0, 600.0),
),
close_requests: 0,
}
}
// Pass these callbacks to radix::render_slide_panel_overlay.
fn handlers(cx: &mut Context<Self>) -> SlidePanelOverlayHandlers {
SlidePanelOverlayHandlers {
key_down: Box::new(cx.listener(|app, event: &KeyDownEvent, window, cx| {
if event.keystroke.key == "escape" && app.state.handle_escape(window, cx) {
app.close_requests += 1;
cx.notify();
}
})),
backdrop_mouse_down: Box::new(cx.listener(|app, _, _, cx| {
if app.state.request_close() {
app.close_requests += 1;
cx.notify();
}
})),
}
}
}Integration snippet, checked against the current SDK and Radix crates. cx is the initialized owner context. Keep spawned entities and subscriptions in the owning view.
Radix styling
slide_panel_state(&look, anchor, size_config) captures geometry and motion defaults. Render with radix::render_slide_panel_overlay for a window drawer, render_slide_panel_inset for an inset right drawer, or render_slide_panel_surface for a bounded local surface. These helpers resolve live Radix surface and resize colors; the app still owns state, focus restoration, backdrop, Escape, and resize handlers.
Pass an explicit Look, including forks. Theme adapters retain that binding; notify affected controls and their owners after palette, mode, or stylesheet edits. Resolved look values are snapshots and must be resolved again during render.
See the Radix control support table for adapter and utility status.
SDK behavior & customization
App-owned state plus render templates, not a spawnable SlidePanel entity.
Application interaction
Slide Panel uses application-owned state and renderer handlers, not SlidePanelEvent. The owner’s close, backdrop, and resize handlers update SlidePanelState and request a redraw.